]> granicus.if.org Git - graphviz/commitdiff
Slightly better estimating of fontsize for builtin fonts.
authorellson <devnull@localhost>
Fri, 26 May 2006 18:00:41 +0000 (18:00 +0000)
committerellson <devnull@localhost>
Fri, 26 May 2006 18:00:41 +0000 (18:00 +0000)
lib/common/gdgen.c
plugin/gd/gvrender_gd.c

index be6acb1f12d90d82b8d0d8e2fb0d9b05ab94fbc1..4db7d44ac7f05f99a9d8fbaf10af8b191c4eaa04 100644 (file)
@@ -558,6 +558,7 @@ static void gd_textpara(point p, textpara_t * para)
     ep.x = mp.x + para->width;
 
     mp = gdpt(mp);
+    fontsz *= CompScale;
     if (fontsz <= FONTSIZE_MUCH_TOO_SMALL) {
        /* ignore entirely */
     } else if (fontsz <= FONTSIZE_TOO_SMALL) {
@@ -586,19 +587,19 @@ static void gd_textpara(point p, textpara_t * para)
            gd_missingfont(err, cstk[SP].fontfam);
 #endif
            mp.y += 2;
-           if (fontsz <= 8.5) {
+           if (fontsz <= 10) {
                gdImageString(im, gdFontTiny,
                              ROUND(mp.x), ROUND(mp.y - 9.),
                              (unsigned char *) str, cstk[SP].pencolor);
-           } else if (fontsz <= 9.5) {
+           } else if (fontsz <= 13) {
                gdImageString(im, gdFontSmall,
                              ROUND(mp.x), ROUND(mp.y - 12.),
                              (unsigned char *) str, cstk[SP].pencolor);
-           } else if (fontsz <= 10.5) {
+           } else if (fontsz <= 14) {
                gdImageString(im, gdFontMediumBold,
                              ROUND(mp.x), ROUND(mp.y - 13.),
                              (unsigned char *) str, cstk[SP].pencolor);
-           } else if (fontsz <= 11.5) {
+           } else if (fontsz <= 15) {
                gdImageString(im, gdFontLarge,
                              ROUND(mp.x), ROUND(mp.y - 14.),
                              (unsigned char *) str, cstk[SP].pencolor);
index bc11efa85f0b80813af132003b36c9ddab65ebce..1c0a481736cfd637db73873e3fd7b45a38f40417 100644 (file)
@@ -427,9 +427,10 @@ static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
        ep.y = mp.y = p.y;
     }
 
-    if (fontsz * job->compscale.x <= FONTSIZE_MUCH_TOO_SMALL) {
+    fontsz *= job->compscale.x;
+    if (fontsz <= FONTSIZE_MUCH_TOO_SMALL) {
        /* ignore entirely */
-    } else if (fontsz * job->compscale.x <= FONTSIZE_TOO_SMALL) {
+    } else if (fontsz <= FONTSIZE_TOO_SMALL) {
        /* draw para in place of text */
        gdImageLine(im, ROUND(mp.x), ROUND(mp.y),
                    ROUND(ep.x), ROUND(ep.y),
@@ -454,24 +455,23 @@ static void gdgen_textpara(GVJ_t * job, pointf p, textpara_t * para)
            /* revert to builtin fonts */
            gdgen_missingfont(err, style->fontfam);
 #endif
-           fontsz *= job->dpi.x / POINTS_PER_INCH;
            mp.y += 2;
-           if (fontsz <= 8.5) {
+           if (fontsz <= 10) {
                gdImageString(im, gdFontTiny,
                              ROUND(mp.x), ROUND(mp.y - 9.),
                              (unsigned char *) str,
                              style->pencolor.u.index);
-           } else if (fontsz <= 9.5) {
+           } else if (fontsz <= 13) {
                gdImageString(im, gdFontSmall,
                              ROUND(mp.x), ROUND(mp.y - 12.),
                              (unsigned char *) str,
                              style->pencolor.u.index);
-           } else if (fontsz <= 10.5) {
+           } else if (fontsz <= 14) {
                gdImageString(im, gdFontMediumBold,
                              ROUND(mp.x), ROUND(mp.y - 13.),
                              (unsigned char *) str,
                              style->pencolor.u.index);
-           } else if (fontsz <= 11.5) {
+           } else if (fontsz <= 15) {
                gdImageString(im, gdFontLarge,
                              ROUND(mp.x), ROUND(mp.y - 14.),
                              (unsigned char *) str,