From 732dcfc85078dafb4b5983de3cadb7a65329dc47 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Sun, 29 Dec 2019 20:08:38 +0100 Subject: [PATCH] Ignore all color fonts when using XFT * etc/NEWS: Announce change to matching color fonts when using XFT. * src/ftfont.c (ftfont_list) [HAVE_XFT && FC_COLOR]: Query for the color attribute of the matched font, and skip it if it is not FcFalse (Bug#37786). --- etc/NEWS | 8 ++++++++ src/ftfont.c | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index e630bb71fec..c6051c97f5b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -296,6 +296,14 @@ To get the old, less-secure behavior, you can set the *** When run by root, emacsclient no longer connects to non-root sockets. (Instead you can use Tramp methods to run root commands in a non-root Emacs.) +--- +*** 'xft-ignore-color-fonts' now ignores even more color fonts. +There are color fonts that managed to bypass the existing checks, +causing XFT crashes, they are now filtered out. Setting +'xft-ignore-color-conts' to nil removes those checks, which might +require setting 'face-ignored-fonts' to filter out problematic fonts. +Known problematic fonts are "Noto Color Emoji" and "Emoji One". + +++ ** New user option 'what-cursor-show-names'. When non-nil, 'what-cursor-position' will show the name of the character diff --git a/src/ftfont.c b/src/ftfont.c index b8199dc4ba7..5bc048c3003 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.39.2