]> granicus.if.org Git - graphviz/commitdiff
Use metrics tables. No point in resorting to metrics of the builtin fonts.
authorellson <devnull@localhost>
Fri, 26 May 2006 16:58:40 +0000 (16:58 +0000)
committerellson <devnull@localhost>
Fri, 26 May 2006 16:58:40 +0000 (16:58 +0000)
lib/common/fontmetrics.c
lib/common/gdgen.c
lib/common/render.h
plugin/gd/gvrender_gd.c

index 05e82d6b81ea05ad64a292276d21668c4d5b172a..a8b7786af46061b546b5c411787b6096b77bfcb5 100644 (file)
@@ -137,22 +137,11 @@ estimate_textsize(graph_t *g, textpara_t * para, char *fontname, double fontsz,
     char c, *p;
 
     para->width = 0.0;
-    para->width = fontsz;
+    para->height = fontsz;
     para->xshow = NULL;
     para->layout = NULL;
     para->free_layout = NULL;
 
-#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE) && defined(HAVE_LIBGD)
-    if (Output_codegen == &GD_CodeGen) {
-       double scale = GD_drawing(g)->dpi / POINTS_PER_INCH;
-       double fsize = fontsz * scale;  /* in pixels */
-       *fontpath = "[internal gd]";
-       if ((p = para->str))
-           para->width = strlen(p) * builtinFontWd(fsize) / scale;
-       para->height = builtinFontHt(fsize) / scale;
-       return;
-    }
-#endif
     if (!strncasecmp(fontname, "cour", 4)) {
        *fontpath = "[internal courier]";
        Fontwidth = courFontWidth;
index b5a54024ad641504bd372b7396c0ce03998c396a..61dd14a413194af6ea5489f66123ae602d9c14c3 100644 (file)
@@ -506,40 +506,6 @@ void gd_missingfont(char *err, char *fontreq)
     }
 }
 
-extern gdFontPtr gdFontTiny, gdFontSmall, gdFontMediumBold, gdFontLarge,
-    gdFontGiant;
-
-#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
-/* builtinFont:
- * Map fontsz in pixels to builtin font.
- */
-static gdFontPtr builtinFont(double fsize)
-{
-    if (fsize <= 8.5) {
-       return gdFontTiny;
-    } else if (fsize <= 9.5) {
-       return gdFontSmall;
-    } else if (fsize <= 10.5) {
-       return gdFontMediumBold;
-    } else if (fsize <= 11.5) {
-       return gdFontLarge;
-    } else {
-       return gdFontGiant;
-    }
-}
-
-int builtinFontHt(double fontsz)
-{
-    gdFontPtr fp = builtinFont(fontsz);
-    return fp->h;
-}
-int builtinFontWd(double fontsz)
-{
-    gdFontPtr fp = builtinFont(fontsz);
-    return fp->w;
-}
-#endif
-
 static void gd_textpara(point p, textpara_t * para)
 {
     char *str, *fontlist;
index 92a2131a8879ba8bec9dffe2ef4897a652ff5b90..5de5c5f517741195cedd7dd9e2093e03e2f23234 100644 (file)
@@ -173,12 +173,6 @@ extern "C" {
 #endif
 
 #ifdef WITH_CODEGENS
-#ifndef HAVE_GD_FREETYPE
-    extern void initDPI(graph_t *);
-    extern double textheight(int nlines, double fontsz);
-    extern int builtinFontHt(double fontsz);
-    extern int builtinFontWd(double fontsz);
-#endif
     extern codegen_info_t *first_codegen(void);
     extern codegen_info_t *next_codegen(codegen_info_t * p);
 #endif
index 2a49be675535b733188180aaec12fc971f33c356..d788f78c46d640a3b5790122c351132bf615cb19 100644 (file)
@@ -372,30 +372,6 @@ void gdgen_missingfont(char *err, char *fontreq)
     }
 }
 
-extern gdFontPtr gdFontTiny, gdFontSmall, gdFontMediumBold, gdFontLarge,
-    gdFontGiant;
-
-#if defined(WITH_CODEGENS) && !defined(HAVE_GD_FREETYPE)
-
-/* builtinFont:
- * Map fontsz in pixels to builtin font.
- */
-static gdFontPtr builtinFont(double fsize)
-{
-    if (fsize <= 8.5) {
-       return gdFontTiny;
-    } else if (fsize <= 9.5) {
-       return gdFontSmall;
-    } else if (fsize <= 10.5) {
-       return gdFontMediumBold;
-    } else if (fsize <= 11.5) {
-       return gdFontLarge;
-    } else {
-       return gdFontGiant;
-    }
-}
-#endif
-
 static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 {
     gvstyle_t *style = job->style;