From: ellson <devnull@localhost>
Date: Wed, 9 Feb 2011 22:13:22 +0000 (+0000)
Subject: back out the FONT_DPI / POINTS_PER_INCH changes that gave incorrect results
X-Git-Tag: LAST_LIBGRAPH~32^2~1061
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a72b7c8123a0946de284de7dd669ed03f3140d7e;p=graphviz

back out the FONT_DPI / POINTS_PER_INCH changes that gave incorrect results
---

diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c
index cf5bebe53..34e3eae9d 100644
--- a/plugin/pango/gvrender_pango.c
+++ b/plugin/pango/gvrender_pango.c
@@ -230,7 +230,7 @@ static void cairogen_textpara(GVJ_t * job, pointf p, textpara_t * para)
 
     cairo_move_to (cr, p.x, -p.y);
     cairo_save(cr);
-    cairo_scale(cr, FONT_DPI / POINTS_PER_INCH, FONT_DPI / POINTS_PER_INCH);
+    cairo_scale(cr, POINTS_PER_INCH / FONT_DPI, POINTS_PER_INCH / FONT_DPI);
     pango_cairo_show_layout(cr, (PangoLayout*)(para->layout));
     cairo_restore(cr);
 }
diff --git a/plugin/pango/gvtextlayout_pango.c b/plugin/pango/gvtextlayout_pango.c
index 9b54ca7f5..7a0fb01da 100644
--- a/plugin/pango/gvtextlayout_pango.c
+++ b/plugin/pango/gvtextlayout_pango.c
@@ -19,8 +19,6 @@
 #include <string.h>
 #include "gvplugin_textlayout.h"
 
-#include "gvplugin_pango.h"
-
 #ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 #ifdef HAVE_PANGO_FC_FONT_LOCK_FACE
@@ -54,6 +52,8 @@ static char* pango_psfontResolve (PostscriptAlias* pa)
     return buf;
 }
 
+#define FONT_DPI 96.
+
 #define ENABLE_PANGO_MARKUP
 #ifdef ENABLE_PANGO_MARKUP
 #define FULL_MARKUP "<span weight=\"bold\" style=\"italic\" underline=\"single\"></span>"
@@ -85,7 +85,6 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath)
 	fontmap = pango_cairo_font_map_get_default();
 	pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(fontmap),FONT_DPI);
 	context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP(fontmap));
-	pango_cairo_context_set_resolution(context,FONT_DPI);
 	options=cairo_font_options_create();
 	cairo_font_options_set_antialias(options,CAIRO_ANTIALIAS_GRAY);
 	cairo_font_options_set_hint_style(options,CAIRO_HINT_STYLE_FULL);
@@ -218,13 +217,13 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath)
     if (logical_rect.width == 0)
 	logical_rect.height = 0;
 
-    textlayout_scale = FONT_DPI / (POINTS_PER_INCH * PANGO_SCALE);
+    textlayout_scale = POINTS_PER_INCH / (FONT_DPI * PANGO_SCALE);
     para->width = (int)(logical_rect.width * textlayout_scale + 1);    /* round up so that width/height are never too small */
     para->height = (int)(logical_rect.height * textlayout_scale + 1);
 
     /* The y offset from baseline to 0,0 of the bitmap representation */
     iter = pango_layout_get_iter (layout);
-    para->yoffset_layout = pango_layout_iter_get_baseline (iter) * POINTS_PER_INCH/(FONT_DPI * PANGO_SCALE);
+    para->yoffset_layout = pango_layout_iter_get_baseline (iter) * textlayout_scale;
 
     /* The distance below midline for y centering of text strings */
     para->yoffset_centerline = 0.10 * para->fontsize;