summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--unix/tkUnixRFont.c29
2 files changed, 30 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a2ae1ed..8b2ea45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-12 Joe English <jenglish@users.sourceforge.net>
+
+ * unix/tkUnixRFont.c: Try a fallback font if XftFontOpenPattern()
+ fails in GetFont (workaround for [Bug 1090382]).
+
2008-03-11 Daniel Steffen <das@users.sourceforge.net>
* library/demos/knightstour.tcl: Aqua GOOBE.
diff --git a/unix/tkUnixRFont.c b/unix/tkUnixRFont.c
index 2487b30..73e091c 100644
--- a/unix/tkUnixRFont.c
+++ b/unix/tkUnixRFont.c
@@ -8,7 +8,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkUnixRFont.c,v 1.23 2008/01/28 15:56:40 jenglish Exp $
+ * RCS: @(#) $Id: tkUnixRFont.c,v 1.24 2008/03/12 16:35:27 jenglish Exp $
*/
#include "tkUnixInt.h"
@@ -80,10 +80,31 @@ GetFont(
i = 0;
}
if (!fontPtr->faces[i].ftFont) {
- FcPattern *pat = FcFontRenderPrepare(0, fontPtr->pattern,
- fontPtr->faces[i].source);
+ FcPattern *pat = FcFontRenderPrepare(0,
+ fontPtr->pattern, fontPtr->faces[i].source);
+ XftFont *ftFont = XftFontOpenPattern(fontPtr->display, pat);
+
+ if (!ftFont) {
+ /*
+ * The previous call to XftFontOpenPattern() should not fail,
+ * but sometimes does anyway. Usual cause appears to be
+ * a misconfigured fontconfig installation; see [Bug 1090382].
+ * Try a fallback:
+ */
+ ftFont = XftFontOpen(fontPtr->display, fontPtr->screen,
+ FC_FAMILY, FcTypeString, "sans",
+ FC_SIZE, FcTypeDouble, 12.0,
+ NULL);
+ }
+ if (!ftFont) {
+ /*
+ * The previous call should definitely not fail.
+ * Impossible to proceed at this point.
+ */
+ Tcl_Panic("Cannot find a usable font.");
+ }
- fontPtr->faces[i].ftFont = XftFontOpenPattern(fontPtr->display, pat);
+ fontPtr->faces[i].ftFont = ftFont;
}
return fontPtr->faces[i].ftFont;
}