summaryrefslogtreecommitdiff
path: root/pango/pangofc-fontmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'pango/pangofc-fontmap.c')
-rw-r--r--pango/pangofc-fontmap.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index 017fe44c..0188be90 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