From aabd13bba282563410ef95764cad39f02ecb5d84 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Mon, 4 Nov 2019 17:44:57 +0100 Subject: [PATCH] Ignore color fonts returned from FcFontList To: emacs-devel@gnu.org * src/ftfont.c (ftfont_list): [HAVE_XFT && FC_COLOR]: Ask FcFontList to return FC_COLOR attribute. Check returned attribute for non-FcFalse, since some color fonts have a color attribute that's neither FcFalse nor FcTrue (Bug#37786). --- src/ftfont.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ftfont.c b/src/ftfont.c index 77a4cf5de5..b066f55a18 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -864,6 +864,9 @@ ftfont_list (struct frame *f, Lisp_Object spec) #endif /* FC_CAPABILITY */ #ifdef FC_FONTFORMAT FC_FONTFORMAT, +#endif +#if defined HAVE_XFT && defined FC_COLOR + FC_COLOR, #endif NULL); if (! objset) @@ -904,7 +907,19 @@ ftfont_list (struct frame *f, Lisp_Object spec) for (i = 0; i < fontset->nfont; i++) { Lisp_Object entity; - +#if defined HAVE_XFT && defined FC_COLOR + { + /* Some fonts, notably NotoColorEmoji, have an FC_COLOR value + that's neither FcTrue nor FcFalse, which means FcFontList + returns them even when it shouldn't really do so, so we + need to manually skip them here (Bug#37786). */ + FcBool b; + if (Vxft_ignore_color_fonts + && FcPatternGetBool (fontset->fonts[i], FC_COLOR, 0, &b) + == FcResultMatch && b != FcFalse) + continue; + } +#endif if (spacing >= 0) { int this; -- 2.19.1.816.gcd69ec8cde