summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-08-18 20:46:05 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-08-18 20:46:05 +0000
commit2b84ec4c130f646b5121d2a3d762e327769456a4 (patch)
treed92c8c7f6d37769f4e0105b42f17782b07e6312b
parent1ca61723a5256e3743e0e51c37923f417485cdc3 (diff)
parentda2e893bbf7161fa45e4fbf3dc192259ebe0ae64 (diff)
downloadpango-2b84ec4c130f646b5121d2a3d762e327769456a4.tar.gz
Merge branch 'cairo-fontconfig-buglet' into 'master'
Use proper fontconfig config object See merge request GNOME/pango!222
-rw-r--r--pango/pangocairo-fcfontmap.c2
-rw-r--r--pango/pangofc-fontmap.c24
2 files changed, 17 insertions, 9 deletions
diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c
index bd3a8583..015b8170 100644
--- a/pango/pangocairo-fcfontmap.c
+++ b/pango/pangocairo-fcfontmap.c
@@ -103,7 +103,7 @@ pango_cairo_fc_font_map_fontset_key_substitute (PangoFcFontMap *fcfontmap G_G
PangoFcFontsetKey *fontkey,
FcPattern *pattern)
{
- FcConfigSubstitute (NULL, pattern, FcMatchPattern);
+ FcConfigSubstitute (pango_fc_font_map_get_config (fcfontmap), pattern, FcMatchPattern);
if (fontkey)
cairo_ft_font_options_substitute (pango_fc_fontset_key_get_context_key (fontkey),
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index ec504094..4c2aa094 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -848,7 +848,10 @@ filter_fontset_by_format (FcFontSet *fontset)
for (i = 0; i < fontset->nfont; i++)
{
if (pango_fc_is_supported_font_format (fontset->fonts[i]))
- FcFontSetAdd (result, FcPatternDuplicate (fontset->fonts[i]));
+ {
+ FcPatternReference (fontset->fonts[i]);
+ FcFontSetAdd (result, fontset->fonts[i]);
+ }
}
return result;
@@ -873,16 +876,21 @@ pango_fc_patterns_get_font_pattern (PangoFcPatterns *pats, int i, gboolean *prep
if (!pats->fontset)
{
FcResult result;
- FcFontSet *fontset;
- FcFontSet *filtered;
+ FcFontSet *filtered[2] = { NULL, };
+ int i, n = 0;
- fontset = FcFontSort (pats->fontmap->priv->config, pats->pattern, FcFalse, NULL, &result);
- filtered = filter_fontset_by_format (fontset);
- FcFontSetDestroy (fontset);
+ for (i = 0; i < 2; i++)
+ {
+ FcFontSet *fonts = FcConfigGetFonts (pats->fontmap->priv->config, i);
+ if (fonts)
+ filtered[n++] = filter_fontset_by_format (fonts);
+ }
+
+ pats->fontset = FcFontSetSort (pats->fontmap->priv->config, filtered, n, pats->pattern, FcTrue, NULL, &result);
- pats->fontset = FcFontSetSort (pats->fontmap->priv->config, &filtered, 1, pats->pattern, FcTrue, NULL, &result);
+ for (i = 0; i < n; i++)
+ FcFontSetDestroy (filtered[i]);
- FcFontSetDestroy (filtered);
if (pats->match)
{