emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-27 732dcfc: Ignore all color fonts when using XFT


From: Robert Pluim
Subject: emacs-27 732dcfc: Ignore all color fonts when using XFT
Date: Sun, 29 Dec 2019 14:29:10 -0500 (EST)

branch: emacs-27
commit 732dcfc85078dafb4b5983de3cadb7a65329dc47
Author: Robert Pluim <address@hidden>
Commit: Robert Pluim <address@hidden>

    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 e630bb7..c6051c9 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 b8199dc..5bc048c 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -865,6 +865,9 @@ ftfont_list (struct frame *f, Lisp_Object spec)
 #ifdef FC_FONTFORMAT
                             FC_FONTFORMAT,
 #endif
+#if defined HAVE_XFT && defined FC_COLOR
+                             FC_COLOR,
+#endif
                             NULL);
   if (! objset)
     goto err;
@@ -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;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]