summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-04 12:04:18 +0000
committerMatthias Clasen <mclasen@redhat.com>2019-08-04 12:04:18 +0000
commit1284511871dd80592ef862fcc5ccb5639ac9fe0e (patch)
treefb6a06e05b3f7c4f1ec5375587c6da7fd638f065
parent48a49b185a5511efd02326fb60d445b759679e09 (diff)
parentd7b706d8f2a6d15b34dabbd38ab8389de5e71ff8 (diff)
downloadpango-1284511871dd80592ef862fcc5ccb5639ac9fe0e.tar.gz
Merge branch 'ignore-more-unsupported-fonts' into 'master'
fc: Ignore more unsupported font formats See merge request GNOME/pango!122
-rw-r--r--pango/pangofc-fontmap.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c
index bddd5410..d0a01115 100644
--- a/pango/pangofc-fontmap.c
+++ b/pango/pangofc-fontmap.c
@@ -895,6 +895,20 @@ pango_fc_fontset_get_key (PangoFcFontset *fontset)
return fontset->key;
}
+static gboolean
+pango_fc_is_supported_font_format (const char *fontformat)
+{
+ /* harfbuzz supports only SFNT fonts. */
+ /* FIXME: "CFF" is used for both CFF in OpenType and bare CFF files, but
+ * HarfBuzz does not support the later and FontConfig does not seem
+ * to have a way to tell them apart.
+ */
+ if (g_ascii_strcasecmp (fontformat, "TrueType") == 0 ||
+ g_ascii_strcasecmp (fontformat, "CFF") == 0)
+ return TRUE;
+ return FALSE;
+}
+
static PangoFont *
pango_fc_fontset_load_next_font (PangoFcFontset *fontset,
gboolean *has_more)
@@ -925,8 +939,7 @@ pango_fc_fontset_load_next_font (PangoFcFontset *fontset,
res = FcPatternGetString (font_pattern, FC_FONTFORMAT, 0, (FcChar8 **)(void*)&s);
g_assert (res == FcResultMatch);
- /* harfbuzz does not support these */
- if (strcmp (s, "Type 1") == 0 || strcmp (s, "PCF") == 0)
+ if (!pango_fc_is_supported_font_format (s))
font = NULL;
else
font = pango_fc_font_map_new_font (fontset->key->fontmap,
@@ -1394,8 +1407,8 @@ pango_fc_font_map_list_families (PangoFontMap *fontmap,
res = FcPatternGetString (fontset->fonts[i], FC_FONTFORMAT, 0, (FcChar8 **)(void*)&s);
g_assert (res == FcResultMatch);
- if (strcmp (s, "Type 1") == 0 || strcmp (s, "PCF") == 0)
- continue; /* harfbuzz does not support these */
+ if (!pango_fc_is_supported_font_format (s))
+ continue;
res = FcPatternGetString (fontset->fonts[i], FC_FAMILY, 0, (FcChar8 **)(void*)&s);
g_assert (res == FcResultMatch);