summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2007-02-13 00:56:12 +0000
committerTor Lillqvist <tml@src.gnome.org>2007-02-13 00:56:12 +0000
commit087d149c8f3051c49e9bbe9f45d59dccdbaa7ea3 (patch)
tree41d472684e9d5c6b60f6c70a424cfa7d74b6f8d3
parentaca1ce6334c9aa1b667ee950d32803338d0e46d7 (diff)
downloadpango-087d149c8f3051c49e9bbe9f45d59dccdbaa7ea3.tar.gz
If something has gone wrong in setting the family of the font description,
2007-02-13 Owen Taylor <otaylor@redhat.com> * pango/pangowin32-fontmap.c (pango_win32_insert_font): If something has gone wrong in setting the family of the font description, don't bother with the font as it isn't usable and will cause crashes later anyway. (#404295) svn path=/branches/pango-1-14/; revision=2193
-rw-r--r--ChangeLog7
-rw-r--r--pango/pangowin32-fontmap.c14
2 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index e31548a8..05186cd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-13 Owen Taylor <otaylor@redhat.com>
+
+ * pango/pangowin32-fontmap.c (pango_win32_insert_font): If
+ something has gone wrong in setting the family of the font
+ description, don't bother with the font as it isn't usable and
+ will cause crashes later anyway. (#404295)
+
2007-01-31 Tor Lillqvist <tml@novell.com>
* pango/Makefile.am: Use pangocairo.def only on Win32, not
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 44f09d19..e615d349 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -774,6 +774,7 @@ pango_win32_insert_font (PangoWin32FontMap *win32fontmap,
LOGFONT *lfp)
{
LOGFONT *lfp2 = NULL;
+ PangoFontDescription *description;
PangoWin32Family *font_family;
PangoWin32Face *win32face;
PangoWin32SizeInfo *size_info;
@@ -839,8 +840,19 @@ pango_win32_insert_font (PangoWin32FontMap *win32fontmap,
PING(("g_slist_length(size_info->logfonts)=%d", g_slist_length(size_info->logfonts)));
+ description = pango_win32_font_description_from_logfont (lfp2);
+
+ /* In some cases, extracting a name for a font can fail; such fonts
+ * aren't usable for us
+ */
+ if (!pango_font_description_get_family (description))
+ {
+ pango_font_description_free (description);
+ return;
+ }
+
win32face = g_object_new (PANGO_WIN32_TYPE_FACE, NULL);
- win32face->description = pango_win32_font_description_from_logfont (lfp2);
+ win32face->description = description;
win32face->cached_fonts = NULL;