move the measure func to render.c its more similar code there
authorDana Jansens <danakj@orodu.net>
Thu, 29 May 2003 00:19:58 +0000 (00:19 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 29 May 2003 00:19:58 +0000 (00:19 +0000)
glft/font.c
glft/render.c

index 332855061b75e204b5555f7fff6b0dbbbf198326..6ebab3670751dd5a4a33c0cf499bf8e446911bbe 100644 (file)
@@ -252,6 +252,7 @@ struct GlftGlyph *GlftFontGlyph(struct GlftFont *font, const char *c)
         } else {
             /*g->width = TRUNC(ROUND(font->face->glyph->advance.x));*/
             g->width = font->face->glyph->metrics.width >> 6;
+            g_message("Width: %c = %d", *c, g->width);
         }
         g->height = -(font->face->glyph->metrics.height >> 6);
 
@@ -260,34 +261,3 @@ struct GlftGlyph *GlftFontGlyph(struct GlftFont *font, const char *c)
 
     return g;
 }
-
-void GlftMeasureString(struct GlftFont *font,
-                       const char *str,
-                       int bytes,
-                       int *w,
-                       int *h)
-{
-    const char *c;
-    struct GlftGlyph *g;
-
-    if (!g_utf8_validate(str, bytes, NULL)) {
-        GlftDebug("Invalid UTF-8 in string\n");
-        return;
-    }
-
-    *w = 0;
-    *h = 0;
-
-    c = str;
-    while (c - str < bytes) {
-        g = GlftFontGlyph(font, c);
-        if (g) {
-            *w += g->width;
-            *h = MAX(g->height, *h);
-        } else {
-            *w += font->max_advance_width;
-        }
-        c = g_utf8_next_char(c);
-    }
-}
-
index 5bb2711ed1d59500bd8f87186afd951f6ec4a2bc..5ea2bfea24c36aa428880968ba01f3c704c97625 100644 (file)
@@ -105,3 +105,33 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes,
 
     glPopMatrix();
 }
+
+void GlftMeasureString(struct GlftFont *font,
+                       const char *str,
+                       int bytes,
+                       int *w,
+                       int *h)
+{
+    const char *c;
+    struct GlftGlyph *g;
+
+    if (!g_utf8_validate(str, bytes, NULL)) {
+        GlftDebug("Invalid UTF-8 in string\n");
+        return;
+    }
+
+    *w = 0;
+    *h = 0;
+
+    c = str;
+    while (c - str < bytes) {
+        g = GlftFontGlyph(font, c);
+        if (g) {
+            *w += g->width;
+            *h = MAX(g->height, *h);
+        } else {
+            *w += font->max_advance_width;
+        }
+        c = g_utf8_next_char(c);
+    }
+}