GNU bug report logs - #37786
26.3; Emacs crashes when calling function to decode string

Previous Next

Package: emacs;

Reported by: Allen Li <darkfeline <at> felesatra.moe>

Date: Thu, 17 Oct 2019 04:12:01 UTC

Severity: normal

Tags: fixed

Merged with 37895

Found in version 26.3

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #46 received at 37786 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Allen Li <darkfeline <at> felesatra.moe>
Cc: 37786 <at> debbugs.gnu.org
Subject: Re: bug#37786: 26.3; Emacs crashes when calling function to decode
 string
Date: Tue, 05 Nov 2019 18:40:28 +0100
[Message part 1 (text/plain, inline)]
>>>>> On Sun, 27 Oct 2019 09:26:35 +0100, Robert Pluim <rpluim <at> gmail.com> said:

>>>>> On Sat, 26 Oct 2019 02:44:52 -0700, Allen Li <darkfeline <at> felesatra.moe> said:
    >>> Hmm. Could you try the following against emacs-26 and see if it fixes
    >>> your crash? (the character will almost certainly end up displayed
    >>> wrong). This looks more like a fontconfig bug than anything else: the
    >>> pattern we've supplied to FcFontList explicitly says "donʼt give me
    >>> color fonts".

    Allen> Yep, this fixes the crash and I get the box with unicode codepoint
    Allen> inside.  I don't know anything about fontconfig, so I can't comment on
    Allen> whether this is a fontconfig bug.

    Robert> Thanks for testing. Iʼll have to write a standalone test case against
    Robert> fontconfig before I can say whether itʼs a fontconfig bug or not, in
    Robert> the meantime Iʼll clean up the patch.

I think itʼs a fontconfig bug, but Iʼve received no response from the
fontconfig guys. Perhaps I need to use their new-fangled issue tracker
thing rather than good old email. In any case, both Arch and Fedora 31
have fontconfig packages with this issue, so we need to paper^Wfix the
issue our end.

[0001-Ignore-color-fonts-returned-from-FcFontList.patch (text/x-patch, inline)]
From aabd13bba282563410ef95764cad39f02ecb5d84 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim <at> gmail.com>
Date: Mon, 4 Nov 2019 17:44:57 +0100
Subject: [PATCH] Ignore color fonts returned from FcFontList
To: emacs-devel <at> 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


This bug report was last modified 5 years and 273 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.