From 7464404e7700c83dba0760badd62746c7e05d7c6 Mon Sep 17 00:00:00 2001 From: ellson Date: Fri, 26 May 2006 16:58:40 +0000 Subject: [PATCH] Use metrics tables. No point in resorting to metrics of the builtin fonts. --- lib/common/fontmetrics.c | 13 +------------ lib/common/gdgen.c | 34 ---------------------------------- lib/common/render.h | 6 ------ plugin/gd/gvrender_gd.c | 24 ------------------------ 4 files changed, 1 insertion(+), 76 deletions(-) diff --git a/lib/common/fontmetrics.c b/lib/common/fontmetrics.c index 05e82d6b8..a8b7786af 100644 --- a/lib/common/fontmetrics.c +++ b/lib/common/fontmetrics.c @@ -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; diff --git a/lib/common/gdgen.c b/lib/common/gdgen.c index b5a54024a..61dd14a41 100644 --- a/lib/common/gdgen.c +++ b/lib/common/gdgen.c @@ -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; diff --git a/lib/common/render.h b/lib/common/render.h index 92a2131a8..5de5c5f51 100644 --- a/lib/common/render.h +++ b/lib/common/render.h @@ -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 diff --git a/plugin/gd/gvrender_gd.c b/plugin/gd/gvrender_gd.c index 2a49be675..d788f78c4 100644 --- a/plugin/gd/gvrender_gd.c +++ b/plugin/gd/gvrender_gd.c @@ -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; -- 2.50.1