From: ellson Date: Wed, 9 Feb 2011 21:15:25 +0000 (+0000) Subject: factor out FONT_DPI into header so that its defined just once X-Git-Tag: LAST_LIBGRAPH~32^2~1062 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbe0ba6b943ba95e21c601c9cef3c06a474e853d;p=graphviz factor out FONT_DPI into header so that its defined just once --- diff --git a/plugin/pango/gvplugin_pango.h b/plugin/pango/gvplugin_pango.h new file mode 100644 index 000000000..8c4df610a --- /dev/null +++ b/plugin/pango/gvplugin_pango.h @@ -0,0 +1 @@ +#define FONT_DPI 96. diff --git a/plugin/pango/gvrender_pango.c b/plugin/pango/gvrender_pango.c index bf250f65f..cf5bebe53 100644 --- a/plugin/pango/gvrender_pango.c +++ b/plugin/pango/gvrender_pango.c @@ -26,6 +26,8 @@ #include "gvplugin_device.h" #include "gvio.h" +#include "gvplugin_pango.h" + #ifdef HAVE_PANGOCAIRO #include @@ -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); diff --git a/plugin/pango/gvtextlayout_pango.c b/plugin/pango/gvtextlayout_pango.c index 32e22f292..9b54ca7f5 100644 --- a/plugin/pango/gvtextlayout_pango.c +++ b/plugin/pango/gvtextlayout_pango.c @@ -19,6 +19,8 @@ #include #include "gvplugin_textlayout.h" +#include "gvplugin_pango.h" + #ifdef HAVE_PANGOCAIRO #include #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 "" @@ -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 */