]> granicus.if.org Git - graphviz/commitdiff
factor out FONT_DPI into header so that its defined just once
authorellson <devnull@localhost>
Wed, 9 Feb 2011 21:15:25 +0000 (21:15 +0000)
committerellson <devnull@localhost>
Wed, 9 Feb 2011 21:15:25 +0000 (21:15 +0000)
plugin/pango/gvplugin_pango.h [new file with mode: 0644]
plugin/pango/gvrender_pango.c
plugin/pango/gvtextlayout_pango.c

diff --git a/plugin/pango/gvplugin_pango.h b/plugin/pango/gvplugin_pango.h
new file mode 100644 (file)
index 0000000..8c4df61
--- /dev/null
@@ -0,0 +1 @@
+#define FONT_DPI 96.
index bf250f65f0b2f30f73573d57765d3858877a20df..cf5bebe53ed31cdf38a1938a64a70b606097f336 100644 (file)
@@ -26,6 +26,8 @@
 #include "gvplugin_device.h"
 #include "gvio.h"
 
+#include "gvplugin_pango.h"
+
 #ifdef HAVE_PANGOCAIRO
 #include <pango/pangocairo.h>
 
@@ -39,9 +41,6 @@ typedef enum {
 
 #define ARRAY_SIZE(A) (sizeof(A)/sizeof(A[0]))
 
-/* FIXME - FONT_DPI also defined in gvtextlayout_pango.c - need shared header */
-#define FONT_DPI 96.
-
 static double dashed[] = {6.};
 static int dashed_len = ARRAY_SIZE(dashed);
 
index 32e22f292ca134f3ae1d30220de7c050c2009010..9b54ca7f50535eb20f274929a477db380ef64233 100644 (file)
@@ -19,6 +19,8 @@
 #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
@@ -52,8 +54,6 @@ 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>"
@@ -83,9 +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.);
+       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,96.);
+       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);
@@ -108,7 +108,7 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath)
            fnt = fontname;
 
        desc = pango_font_description_from_string(fnt);
-        /* all text layout is done at a scale of 96ppi */
+        /* all text layout is done at a scale of FONT_DPI (nominaly 96.) */
         pango_font_description_set_size (desc, (gint)(fontsize * PANGO_SCALE));
 
         if (fontpath && (font = pango_font_map_load_font(fontmap, context, desc))) {  /* -v support */