summaryrefslogtreecommitdiff
path: root/pango/pangofc-font.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-08-14 23:51:20 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-08-14 23:51:20 +0000
commit0cd7bf0b843cfbb6eb0dafa8e724483546d2d085 (patch)
treebf4b849d5a22883f21ac1d7f10cb08ecff973d0e /pango/pangofc-font.c
parentf7a3f933856c13732c2b8a6a1c24cf1e96c9e506 (diff)
downloadpango-0cd7bf0b843cfbb6eb0dafa8e724483546d2d085.tar.gz
Bug 466755 – pango hangul is crashing in gnome-about because it is
2007-08-14 Behdad Esfahbod <behdad@gnome.org> Bug 466755 – pango hangul is crashing in gnome-about because it is failing to retrieve a font. * pango/pangofc-font.c (pango_fc_font_real_get_glyph), (pango_fc_font_kern_glyphs), (pango_fc_font_get_raw_extents): Protect against NULL face. * pango/shape.c (pango_shape): Improve error message by writing out shaping engine type name and the text too. svn path=/trunk/; revision=2396
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r--pango/pangofc-font.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index dec1f680..f48cffb7 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -560,14 +560,19 @@ pango_fc_font_real_get_glyph (PangoFcFont *font,
if (entry->ch != wc)
{
face = PANGO_FC_FONT_LOCK_FACE (font);
- index = FcFreeTypeCharIndex (face, wc);
- if (index > (FT_UInt)face->num_glyphs)
- index = 0;
+ if (G_LIKELY (face))
+ {
+ index = FcFreeTypeCharIndex (face, wc);
+ if (index > (FT_UInt)face->num_glyphs)
+ index = 0;
+
+ PANGO_FC_FONT_UNLOCK_FACE (font);
+ }
+ else
+ index = 0;
entry->ch = wc;
entry->glyph = index;
-
- PANGO_FC_FONT_UNLOCK_FACE (font);
}
return entry->glyph;
@@ -729,7 +734,7 @@ pango_fc_font_kern_glyphs (PangoFcFont *font,
g_return_if_fail (glyphs != NULL);
face = PANGO_FC_FONT_LOCK_FACE (font);
- if (!face)
+ if (G_UNLIKELY (!face))
return;
if (!FT_HAS_KERNING (face))
@@ -871,6 +876,12 @@ pango_fc_font_get_raw_extents (PangoFcFont *fcfont,
g_return_if_fail (PANGO_IS_FC_FONT (fcfont));
face = PANGO_FC_FONT_LOCK_FACE (fcfont);
+ if (G_UNLIKELY (!face))
+ {
+ /* Get generic unknown-glyph extents. */
+ pango_font_get_glyph_extents (NULL, glyph, ink_rect, logical_rect);
+ return;
+ }
if (glyph == PANGO_GLYPH_EMPTY)
gm = NULL;