APPROVE COMMIT sjt-xft
The code involved is still pretty horrible, I don't understand it.
But the crash went away for me, at least for now.
Also fix a stupid typo in xlwtabs.c.
Index: lwlib/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/ChangeLog,v
retrieving revision 1.64.2.7
diff -u -U0 -r1.64.2.7 ChangeLog
--- lwlib/ChangeLog 9 Mar 2005 06:31:09 -0000 1.64.2.7
+++ lwlib/ChangeLog 9 Mar 2005 09:27:23 -0000
@@ -0,0 +1,4 @@
+2005-03-09 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * xlwtabs.c (TabsGeometryManager): Fix "fat fingers" mistake.
+
Index: src/ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.758.2.17
diff -u -U0 -r1.758.2.17 ChangeLog
--- src/ChangeLog 9 Mar 2005 06:31:22 -0000 1.758.2.17
+++ src/ChangeLog 9 Mar 2005 09:27:28 -0000
@@ -0,0 +1,5 @@
+2005-03-09 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * objects-x.c (x_font_instance_truename): Try to fix XListFonts
+ crash by not hand random Xft results to core Xlib functions.
+
Index: lwlib/xlwtabs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwtabs.c,v
retrieving revision 1.4.2.9
diff -u -r1.4.2.9 xlwtabs.c
--- lwlib/xlwtabs.c 9 Mar 2005 06:31:10 -0000 1.4.2.9
+++ lwlib/xlwtabs.c 9 Mar 2005 09:27:40 -0000
@@ -1143,7 +1143,7 @@
~((reply->border_width == tab->core.border_width
? CWBorderWidth : 0)
|(reply->width == tab->core.width ? CWWidth : 0)
- |(reply->height == tab->core.height ? CWHeight : 0))
+ |(reply->height == tab->core.height ? CWHeight : 0));
return XtGeometryAlmost ;
}
Index: src/objects-x.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/objects-x.c,v
retrieving revision 1.26.2.11
diff -u -r1.26.2.11 objects-x.c
--- src/objects-x.c 9 Mar 2005 06:31:42 -0000 1.26.2.11
+++ src/objects-x.c 9 Mar 2005 09:27:40 -0000
@@ -711,7 +711,6 @@
return Qnil;
}
-/* #### The logic in this function seems fxxked. */
static Lisp_Object
x_font_instance_truename (Lisp_Font_Instance *f, Error_Behavior errb)
{
@@ -725,14 +724,17 @@
#ifdef USE_XFT
/* First, try an Xft font. */
- if (NILP (FONT_INSTANCE_TRUENAME (f)))
+ if (NILP (FONT_INSTANCE_TRUENAME (f)) && FONT_INSTANCE_X_XFTFONT (f))
{
int core;
FcPattern *pat = FONT_INSTANCE_X_XFTFONT (f)->pattern;
FcResult res_xlfd = FcPatternGetString (pat, XFT_XLFD, 0, &fcfont);
FcResult res_core = FcPatternGetBool (pat, XFT_CORE, 0, &core);
- if (res_xlfd == FcResultTypeMismatch || res_core == FcResultTypeMismatch)
+ /* #### boy this is broken!! FIXME!!
+ Probably only makes sense in Xft v1. */
+ if (res_xlfd == FcResultNoMatch || res_core == FcResultNoMatch || !core)
+ /* #### should we test fcfont for something here? if so, what? */
{
/* we've got an Xft font! */
FcChar8 *res = FcNameUnparse (pat);
@@ -749,20 +751,35 @@
return FONT_INSTANCE_TRUENAME (f);
}
else
- { /* Now we're f.... */
+ {
maybe_signal_error (Qgui_error,
- "Couldn't determine font truename",
+ "Couldn't unparse Xft font to truename",
Qnil, Qfont, errb);
- return Qnil;
+ /* used to return Qnil here */
}
}
- else
+ else if (res_xlfd == FcResultMatch && res_core == FcResultMatch)
{
- /* #### Why isn't this appropriate for core fonts, too? */
FONT_INSTANCE_TRUENAME (f) =
build_ext_string (truename_via_XListFonts (dpy,
(Extbyte *) &fcfont[0]),
Qx_font_name_encoding);
+ return FONT_INSTANCE_TRUENAME (f);
+ }
+ else if (res_xlfd == FcResultTypeMismatch || res_core == FcResultTypeMismatch)
+ { /* Now we're f.... */
+ maybe_signal_error (Qgui_error,
+ "Xft TypeMismatch while determining font truename",
+ Qnil, Qfont, errb);
+ /* used to return Qnil here */
+ }
+ /* we shouldn't have to worry about FcResultNoId */
+ else
+ { /* Now we're f.... */
+ maybe_signal_error (Qgui_error,
+ "Xft bogus status while determining font truename",
+ Qnil, Qfont, errb);
+ /* used to return Qnil here */
}
}
#endif
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Ask not how you can "do" free software business;
ask what your business can "do for" free software.