summaryrefslogtreecommitdiff
path: root/pango/pangocoretext.c
diff options
context:
space:
mode:
authorKristian Rietveld <kris@lanedo.com>2012-01-28 10:34:52 +0100
committerKristian Rietveld <kris@lanedo.com>2012-01-28 11:24:26 +0100
commit38ada127bfb53911ecd64ced26fd23ec67138b43 (patch)
treef1ec3e56f2183f9b6934afb718dd4c678ec4adb7 /pango/pangocoretext.c
parent37e74619215ede8a4fa7f5edabab14b517e673b2 (diff)
downloadpango-38ada127bfb53911ecd64ced26fd23ec67138b43.tar.gz
Make CoreText backend more robust against broken fonts
Patch written in collaboration with Michael Natterer. Some CTFontDescriptors apparently do not have a style name or font family name set. This patch makes the code take such corner cases into account. The font family problem only appears to occur on Snow Leopard systems, we try to fall back on the font name (postscript name), if that fails, we fall back on a default fallback. In some cases a coverage is also not set. (This seems to happen when we cannot map a broken font back to a correct font descriptor). In such cases we simply return an empty PangoCoverage, which will likely cause the engine to fallback on a different font.
Diffstat (limited to 'pango/pangocoretext.c')
-rw-r--r--pango/pangocoretext.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/pango/pangocoretext.c b/pango/pangocoretext.c
index 5023e934..ee743935 100644
--- a/pango/pangocoretext.c
+++ b/pango/pangocoretext.c
@@ -80,6 +80,10 @@ ct_font_descriptor_get_coverage (CTFontDescriptorRef desc)
coverage = pango_coverage_new ();
charset = CTFontDescriptorCopyAttribute (desc, kCTFontCharacterSetAttribute);
+ if (!charset)
+ /* Return an empty coverage */
+ return coverage;
+
bitmap = CFCharacterSetCreateBitmapRepresentation (kCFAllocatorDefault,
charset);