summaryrefslogtreecommitdiff
path: root/pango/pangoxft-font.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2002-02-26 20:56:32 +0000
committerOwen Taylor <otaylor@src.gnome.org>2002-02-26 20:56:32 +0000
commit4892d6f1a9c477605784a99f3d127cfd68bd9a33 (patch)
treebf82f189afa1d2ce4f01f1c805d2df36525a2fad /pango/pangoxft-font.c
parent25625b1be0d83ee5d9bfb3d66dc2f19e7affaa96 (diff)
downloadpango-4892d6f1a9c477605784a99f3d127cfd68bd9a33.tar.gz
Try to load something (load sans) if we can't load a font that Xft listed.
Tue Feb 26 15:50:35 2002 Owen Taylor <otaylor@redhat.com> * pango/pangoxft-font.c (pango_xft_font_get_font): Try to load something (load sans) if we can't load a font that Xft listed. (Workaround for #72299, reported by Gediminas Paulauskas)
Diffstat (limited to 'pango/pangoxft-font.c')
-rw-r--r--pango/pangoxft-font.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index cf511791..fef5e06a 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -19,6 +19,8 @@
* Boston, MA 02111-1307, USA.
*/
+#include <stdlib.h>
+
#include "pangoxft-private.h"
#include "X11/Xft/XftFreetype.h"
#include "pango-modules.h"
@@ -594,6 +596,29 @@ pango_xft_font_get_font (PangoFont *font)
_pango_xft_font_map_get_info (xfont->fontmap, &display, &screen);
xfont->xft_font = XftFontOpenPattern (display, xfont->font_pattern);
+ if (!xfont->xft_font)
+ {
+ gchar *name = pango_font_description_to_string (xfont->description);
+
+ /* No provision for failure here, unfortunately, various fonts
+ * fail only when FT tries to open them... e.g., fonts with only
+ * bitmaps.
+ */
+ g_warning ("Cannot open font file for font %s", name);
+ g_free (name);
+
+ xfont->xft_font = XftFontOpen (display, screen,
+ XFT_FAMILY, XftTypeString, "sans",
+ XFT_ENCODING, XftTypeString, "glyphs-fontspecific",
+ XFT_CORE, XftTypeBool, False,
+ XFT_SIZE, XftTypeDouble, (double)pango_font_description_get_size (xfont->description)/PANGO_SCALE,
+ NULL);
+ }
+ if (!xfont->xft_font)
+ {
+ g_warning ("Cannot open fallback font, nothing to do");
+ exit (1);
+ }
face = xfont->xft_font->u.ft.font->face;