From 17a5ef13fd5052ab2c640b192f0e8e5bf30b617a Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 9 Jul 2021 10:11:12 -0400 Subject: fontconfig: Ignore woff fonts harfbuzz creates a face, but doesn't seem to find any glyphs in woff fonts, so filter them out. Sadly, fontfonfig does not have useful format information about this, so we need to crudely filter by filename. --- pango/pangofc-fontmap.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pango/pangofc-fontmap.c b/pango/pangofc-fontmap.c index 7ea5dc52..aada1909 100644 --- a/pango/pangofc-fontmap.c +++ b/pango/pangofc-fontmap.c @@ -962,12 +962,20 @@ pango_fc_is_supported_font_format (FcPattern* pattern) { FcResult res; const char *fontformat; + const char *file; + + /* Harfbuzz loads woff fonts, but we don't get any glyphs */ + res = FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **)(void*)&file); + if (res == FcResultMatch && + (g_str_has_suffix (file, ".woff") || + g_str_has_suffix (file, ".woff2"))) + return FALSE; res = FcPatternGetString (pattern, FC_FONTFORMAT, 0, (FcChar8 **)(void*)&fontformat); if (res != FcResultMatch) return FALSE; - /* harfbuzz supports only SFNT fonts. */ + /* 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. -- cgit v1.2.1