Browse Source

bitmap fromtext() pause for GPU to go idle.

textsize() now uses internal font table, so it works with loaded fonts.
James Bowman 6 years ago
parent
commit
1f5d6f1e3d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      GD2.cpp

+ 2 - 1
GD2.cpp

@@ -168,6 +168,7 @@ void Bitmap::fromtext(int font, const char* s)
 
   GD.finish();
   GD.wr(REG_PCLK, 0);
+  delay(1);
   GD.wr16(REG_HSIZE, size.x);
   GD.wr16(REG_VSIZE, size.y);
 
@@ -1567,7 +1568,7 @@ void GDClass::safeload(const char *filename)
 
 void GDClass::textsize(int &w, int &h, int font, const char *s)
 {
-  uint32_t font_addr = rd32(FONT_ROOT) + 148 * (font - 16);
+  uint32_t font_addr = rd32(0x309074 + 4 * font);
   w = 0;
   while (*s)
     w += GD.rd(font_addr + *s++);