From bd32a19807d0a9c49d84c35564d89a1417c3761f Mon Sep 17 00:00:00 2001 From: ellson Date: Fri, 25 Jan 2008 13:49:19 +0000 Subject: [PATCH] hack to strip ".ttf" from "FreeSans.ttf" in an attempt to find a better font for doxygen on windows --- plugin/pango/gvtextlayout_pango.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/pango/gvtextlayout_pango.c b/plugin/pango/gvtextlayout_pango.c index 899aa1902..a1575825a 100644 --- a/plugin/pango/gvtextlayout_pango.c +++ b/plugin/pango/gvtextlayout_pango.c @@ -58,7 +58,7 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath) PangoAttrList *attrs; GError *error = NULL; #endif - char *text; + char *text, *tfnt, *pos; double textlayout_scale; if (!context) { @@ -84,7 +84,12 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath) else fnt = fontname; - desc = pango_font_description_from_string(fnt); + /* suppress any extents - like in FreeSans.ttf (doxygen backwards compat) */ + tfnt = strdup(fnt); + if ((pos = strrchr(tfnt, '.'))) + *pos = '\0'; + + desc = pango_font_description_from_string(tfnt); if (fontpath) { /* -v support */ #ifdef HAVE_FONTCONFIG @@ -92,10 +97,12 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath) FcFontSet *fs; FcResult result; - if (! FcInit()) + if (! FcInit()) { + free(tfnt); return FALSE; + } - pat = FcNameParse((FcChar8 *) fnt); + pat = FcNameParse((FcChar8 *) tfnt); FcConfigSubstitute (0, pat, FcMatchPattern); FcDefaultSubstitute (pat); fs = FcFontSetCreate(); @@ -126,6 +133,7 @@ static boolean pango_textlayout(textpara_t * para, char **fontpath) *fontpath = fnt; #endif } + free(tfnt); } /* all text layout is done at a scale of 96ppi */ pango_font_description_set_size (desc, (gint)(para->fontsize * PANGO_SCALE)); -- 2.40.0