]> granicus.if.org Git - graphviz/commitdiff
Made changes to set font resolution to 96. Inverted text scaling factor from POINTS_P...
authordperry <devnull@localhost>
Wed, 9 Feb 2011 19:48:11 +0000 (19:48 +0000)
committerdperry <devnull@localhost>
Wed, 9 Feb 2011 19:48:11 +0000 (19:48 +0000)
plugin/pango/gvrender_pango.c
plugin/pango/gvtextlayout_pango.c

index a6ac6592c610fc43828a5691787d8a49d68d9863..bf250f65f0b2f30f73573d57765d3858877a20df 100644 (file)
@@ -231,7 +231,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, POINTS_PER_INCH / FONT_DPI, POINTS_PER_INCH / FONT_DPI);
+    cairo_scale(cr, FONT_DPI / POINTS_PER_INCH, FONT_DPI / POINTS_PER_INCH);
     pango_cairo_show_layout(cr, (PangoLayout*)(para->layout));
     cairo_restore(cr);
 }
index 14d35de5ed98b817be2be14f44fa642234c7151f..32e22f292ca134f3ae1d30220de7c050c2009010 100644 (file)
@@ -83,7 +83,9 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath)
 
     if (!context) {
        fontmap = pango_cairo_font_map_get_default();
+       pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(fontmap),96.);
        context = pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP(fontmap));
+       pango_cairo_context_set_resolution(context,96.);
        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);
@@ -216,13 +218,13 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath)
     if (logical_rect.width == 0)
        logical_rect.height = 0;
 
-    textlayout_scale = POINTS_PER_INCH / (FONT_DPI * PANGO_SCALE);
+    textlayout_scale = FONT_DPI / (POINTS_PER_INCH * 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) * textlayout_scale;
+    para->yoffset_layout = pango_layout_iter_get_baseline (iter) * POINTS_PER_INCH/(FONT_DPI * PANGO_SCALE);
 
     /* The distance below midline for y centering of text strings */
     para->yoffset_centerline = 0.10 * para->fontsize;