Attachment "tk-xft-crash-1.patch" to
ticket [1090382f]
added by
jenglish
2008-03-12 23:04:58.
Index: unix/tkUnixRFont.c
===================================================================
RCS file: /cvsroot/tktoolkit/tk/unix/tkUnixRFont.c,v
retrieving revision 1.23
diff -c -r1.23 tkUnixRFont.c
*** unix/tkUnixRFont.c 28 Jan 2008 15:56:40 -0000 1.23
--- unix/tkUnixRFont.c 12 Mar 2008 16:00:28 -0000
***************
*** 80,89 ****
i = 0;
}
if (!fontPtr->faces[i].ftFont) {
! FcPattern *pat = FcFontRenderPrepare(0, fontPtr->pattern,
! fontPtr->faces[i].source);
! fontPtr->faces[i].ftFont = XftFontOpenPattern(fontPtr->display, pat);
}
return fontPtr->faces[i].ftFont;
}
--- 80,110 ----
i = 0;
}
if (!fontPtr->faces[i].ftFont) {
! 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 = ftFont;
}
return fontPtr->faces[i].ftFont;
}