fix the measure function's loop too
authorDana Jansens <danakj@orodu.net>
Thu, 29 May 2003 00:12:46 +0000 (00:12 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 29 May 2003 00:12:46 +0000 (00:12 +0000)
glft/font.c

index 3c1b33afd8f813844f9225b465c619501e6355fc..332855061b75e204b5555f7fff6b0dbbbf198326 100644 (file)
@@ -279,7 +279,7 @@ void GlftMeasureString(struct GlftFont *font,
     *h = 0;
 
     c = str;
-    while (c) {
+    while (c - str < bytes) {
         g = GlftFontGlyph(font, c);
         if (g) {
             *w += g->width;
@@ -288,7 +288,6 @@ void GlftMeasureString(struct GlftFont *font,
             *w += font->max_advance_width;
         }
         c = g_utf8_next_char(c);
-        if (c - str > bytes) break;
     }
 }