patch Pango to handle font-info failure

Getting NULL from CTFontCollectionCreateMatchingFontDescriptors()
might indicate a font installation problem; I'm not sure. In any case,
checking for NULL avoids a crash on at least one installation.
This commit is contained in:
Matthew Flatt 2015-11-07 08:19:50 -07:00
parent 4d9c5d8dd2
commit e94b07b3aa
2 changed files with 25 additions and 0 deletions

View File

@ -128,6 +128,9 @@
;; Support registration of extra font families:
(define-runtime-path coretext-fontreg-patch "patches/coretext-fontreg.patch")
;; Avoid crash when CTFontCollectionCreateMatchingFontDescriptors fails:
(define-runtime-path coretext-nullarray "patches/coretext-nullarray.patch")
;; Enable "symbol" fonts, and fix off-by-one:
(define-runtime-path win32text-patch "patches/win32text.patch")
@ -441,6 +444,7 @@
"--with-dynamic-modules=no"))
#:patches (list coretext-patch
coretext-fontreg-patch
coretext-nullarray
win32text-patch))]
[("gmp") (config #:patches (if gcc-4.0? (list gmp-weak-patch) null)
#:configure (append

View File

@ -0,0 +1,21 @@
diff -r -u old/pango-1.36.6/pango/pangocoretext-fontmap.c new/pango-1.36.6/pango/pangocoretext-fontmap.c
--- old/pango-1.36.6/pango/pangocoretext-fontmap.c 2015-11-07 08:15:41.000000000 -0700
+++ new/pango-1.36.6/pango/pangocoretext-fontmap.c 2015-11-07 08:16:56.000000000 -0700
@@ -649,7 +649,7 @@
italic_faces = g_hash_table_new (g_direct_hash, g_direct_equal);
- count = CFArrayGetCount (ctfaces);
+ count = (ctfaces ? CFArrayGetCount (ctfaces) : 0);
for (i = 0; i < count; i++)
{
PangoCoreTextFace *face;
@@ -669,7 +669,7 @@
CFRelease (font_descriptors);
CFRelease (attributes);
- CFRelease (ctfaces);
+ if (ctfaces) CFRelease (ctfaces);
/* For all fonts for which a non-synthetic italic variant does
* not exist on the system, we create synthesized versions here.