[pango] Don't RenderPrepare the FcFontMatch result
- From: Behdad Esfahbod <behdad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pango] Don't RenderPrepare the FcFontMatch result
- Date: Mon, 31 Dec 2012 04:12:51 +0000 (UTC)
commit f0cd936cf62c552bc6b17f6ecb70c2de783a9e80
Author: Behdad Esfahbod <behdad behdad org>
Date: Sun Dec 30 18:50:42 2012 -0600
Don't RenderPrepare the FcFontMatch result
After commit 7c1d6208a4b42ef3a3cce0d8dffb214c7a321e5e, the first matched
font was being prepared twice, causing misconfiguration.
pango/pangofc-fontmap.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 017fe44..0188be9 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -242,7 +242,9 @@ static PangoFcPatterns *pango_fc_patterns_new (FcPattern *pat,
static PangoFcPatterns *pango_fc_patterns_ref (PangoFcPatterns *pats);
static void pango_fc_patterns_unref (PangoFcPatterns *pats);
static FcPattern *pango_fc_patterns_get_pattern (PangoFcPatterns *pats);
-static FcPattern *pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i);
+static FcPattern *pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats,
+ int i,
+ gboolean *prepare);
static PangoFcUPattern *uniquify_pattern (PangoFcFontMap *fcfontmap,
FcPattern *pattern);
@@ -850,7 +852,7 @@ pango_fc_patterns_get_pattern (PangoFcPatterns *pats)
}
static FcPattern *
-pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i)
+pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prepare)
{
if (i == 0)
{
@@ -861,7 +863,10 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i)
}
if (pats->match)
- return pats->match;
+ {
+ *prepare = FALSE;
+ return pats->match;
+ }
}
else
{
@@ -877,6 +882,7 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i)
}
}
+ *prepare = TRUE;
if (pats->fontset && i < pats->fontset->nfont)
return pats->fontset->fonts[i];
else
@@ -939,17 +945,22 @@ pango_fc_fontset_load_next_font (PangoFcFontset *fontset)
{
FcPattern *pattern, *font_pattern;
PangoFont *font;
+ gboolean prepare;
pattern = pango_fc_patterns_get_pattern (fontset->patterns);
font_pattern = pango_fc_patterns_get_font_pattern (fontset->patterns,
- fontset->patterns_i++);
+ fontset->patterns_i++,
+ &prepare);
if (G_UNLIKELY (!font_pattern))
return NULL;
- font_pattern = FcFontRenderPrepare (NULL, pattern, font_pattern);
+ if (prepare)
+ {
+ font_pattern = FcFontRenderPrepare (NULL, pattern, font_pattern);
- if (G_UNLIKELY (!font_pattern))
- return NULL;
+ if (G_UNLIKELY (!font_pattern))
+ return NULL;
+ }
#ifdef FC_PATTERN
/* The FC_PATTERN element, which points back to our the original
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]