APPROVE COMMIT sjt-xft
FcInit() never returns a failure, although it can fail. (This is a
bug in fontconfig.) This patch works around that.
Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.758.2.28
diff -u -U0 -r1.758.2.28 ChangeLog
--- src/ChangeLog 23 Sep 2005 18:20:37 -0000 1.758.2.28
+++ src/ChangeLog 24 Sep 2005 12:40:09 -0000
@@ -0,0 +1,10 @@
+2005-09-24 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * objects-x.c (x_find_charset_font): Work around buggy return
+ value in FcInit().
+
Index: src/objects-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/objects-x.c,v
retrieving revision 1.26.2.18
diff -u -r1.26.2.18 objects-x.c
--- src/objects-x.c 18 Apr 2005 03:51:18 -0000 1.26.2.18
+++ src/objects-x.c 24 Sep 2005 12:40:18 -0000
@@ -1243,9 +1185,6 @@
int count = 0;
const Extbyte *patternext;
Lisp_Object result = Qunbound;
-#ifdef USE_XFT
- FcBool waste;
-#endif
int i;
/* #### with Xft need to handle second stage here -- sjt
@@ -1269,12 +1208,18 @@
gives language or repertoire coverage.
*/
- waste = FcInit ();
- if (!waste) /* I don't think this can fail */
- /* #### should we init in xft_fonts_init()
- and FcInitBringUpToDate() here? */
+ FcInit (); /* No-op if already initialized.
+ In fontconfig 2.3.2, this cannot return
+ failure, but that looks like a bug. We
+ check for it with FcGetCurrentConfig(),
+ which *can* fail. */
+ if (!FcConfigGetCurrent()) /* #### should we init in xft_fonts_init()
+ and FcInitBringUpToDate() here?
+ I think not. We should expose FcInit*
+ interfaces to LISP and decide when to
+ reinitialize intelligently. */
stderr_out ("Failed fontconfig initialization\n");
- else if (waste)
+ else
{
FcPattern *fontxft; /* long-lived, freed at end of this block */
FcResult fcresult;
--
Graduate School of Systems and Information Engineering University of Tsukuba
http://turnbull.sk.tsukuba.ac.jp/ Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Economics of Information Communication and Computation Systems
Experimental Economics, Microeconomic Theory, Game Theory