Emacs crashes when loading color fonts (#1519038)

Resolves: #1519038
This commit is contained in:
Jan Synacek 2018-04-04 09:53:23 +02:00
parent 037321c00b
commit f71d70bf31
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,48 @@
commit 408bf21a8c8b5bf5a78785608255463ad1038871
Author: Robert Pluim <rpluim@gmail.com>
Date: Tue Apr 3 11:06:01 2018 +0200
Ignore color fonts when using Xft
* src/font.c (syms_of_font): New configuration variable
xft-ignore-color-fonts, default t.
* src/ftfont.c (ftfont_spec_pattern): Tell fontconfig to ignore
color fonts if xft-ignore-color-fonts is t. (Bug#30874, Bug#30045)
* etc/NEWS: Document xft-ignore-color-fonts.
diff --git a/src/font.c b/src/font.c
index a6d3f5d479..ef3f92b594 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5473,6 +5473,13 @@ Disabling compaction of font caches might enlarge the Emacs memory
footprint in sessions that use lots of different fonts. */);
inhibit_compacting_font_caches = 0;
+ DEFVAR_BOOL ("xft-ignore-color-fonts",
+ Vxft_ignore_color_fonts,
+ doc: /*
+Non-nil means don't query fontconfig for color fonts, since they often
+cause Xft crashes. Only has an effect in Xft builds. */);
+ Vxft_ignore_color_fonts = 1;
+
#ifdef HAVE_WINDOW_SYSTEM
#ifdef HAVE_FREETYPE
syms_of_ftfont ();
diff --git a/src/ftfont.c b/src/ftfont.c
index c2e093e633..24a92dd52e 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -764,6 +764,13 @@ ftfont_spec_pattern (Lisp_Object spec, char *otlayout, struct OpenTypeSpec **ots
if (scalable >= 0
&& ! FcPatternAddBool (pattern, FC_SCALABLE, scalable ? FcTrue : FcFalse))
goto err;
+#ifdef HAVE_XFT
+ /* We really don't like color fonts, they cause Xft crashes. See
+ Bug#30874. */
+ if (Vxft_ignore_color_fonts
+ && ! FcPatternAddBool(pattern, FC_COLOR, FcFalse))
+ goto err;
+#endif
goto finish;

View File

@ -5,7 +5,7 @@ Summary: GNU Emacs text editor
Name: emacs
Epoch: 1
Version: 25.3
Release: 8%{?dist}
Release: 9%{?dist}
License: GPLv3+ and CC0-1.0
URL: http://www.gnu.org/software/emacs/
Group: Applications/Editors
@ -27,6 +27,8 @@ Patch2: emacs-pdf-default.patch
Patch3: emacs-system-crypto-policies.patch
# http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d781662873f228b110a128f7a2b6583a4d5e0a3a
Patch4: emacs-xwidget.patch
# https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=408bf21a8c8b5bf5a78785608255463ad1038871
Patch5: emacs-xft-color-font-crash.patch
BuildRequires: atk-devel
BuildRequires: cairo-devel
@ -191,6 +193,7 @@ packages that add functionality to Emacs.
%patch2 -p1 -b .pdf-default.patch
%patch3 -p1 -b .system-crypto-policies
%patch4 -p1
%patch5 -p1
autoconf
# We prefer our emacs.desktop file
@ -481,6 +484,9 @@ fi
%dir %{_datadir}/emacs/site-lisp/site-start.d
%changelog
* Wed Apr 4 2018 Jan Synáček <jsynacek@redhat.com> - 1:25.3-9
- Emacs crashes when loading color fonts (#1519038)
* Sun Feb 11 2018 Sandro Mani <manisandro@gmail.com> - 1:25.3-8
- Rebuild (giflib)