APPROVE COMMIT 21.5
Tested on Mac OS X "Tiger".
There have been several reports of problems with Xft font resources
recently. This patch addresses issues with use of *X resources* to
set Xft fonts for the Tabs and Menubar. It will not help the others
(including very poor Options Menu and Customize support, and problems
with buffer fonts).
Apparently some experimental work I was doing on creating an Xt
resource converter for Xft fonts leaked into an integration branch.
As part of that work I changed the name of the resource used for Xft
fonts from "xftFont" to "fcFontName", and reserved the xftFont
resource for the (incomplete) automatic converter.
This patch restores the functionality of the "xftFont" resource of the
Tabs and Menubar widgets. For completeness, I will mention that it
gives precedence to the fcFontName resource, but this is only for my
convenience; this patch should "just work" with properly set xftFont
resources in .Xresources.
I've also changed the default font for Tabs from the absurd Aircut to
Helvetica. (I'm currently using Bitstream Vera:italic, which is a
nice effect.)
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 32a1740..1dac37d 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,18 @@
+2006-11-17 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * xlwmenu.c (xlwMenuResources):
+ * xlwmenu.c (XlwMenuInitialize):
+ * xlwmenuP.h (_XlwMenu_part):
+ * xlwtabs.c (resources):
+ * xlwtabs.c (TabsInit):
+ * xlwtabsP.h (TabsPart):
+ New xftFontName member in each widget part struct, corresponds to
+ xftFont String resource.
+ Initialize renderFont private member from fcFontName if non-NULL,
+ otherwise initialize from xftFontName.
+
+ * xlwtabs.h: Update parameter table.
+
2006-06-16 Jerry James <james(a)xemacs.org>
* lwlib-Xlw.c (xlw_scrollbar_callback): Do not dereference
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index b6a5110..9445cb8 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -95,11 +95,11 @@ xlwMenuResources[] =
#ifdef USE_XFT_MENUBARS
{XtNfcFontName, XtCFcFontName, XtRString, sizeof (String),
offset(menu.fcFontName),
- XtRString, (XtPointer) "Helvetica-12:bold"},
+ XtRString, (XtPointer) NULL},
/* #### This needs to be fixed to give a proper type and converter for
XftFonts. See also xlwtabs.c. */
- {XtNxftFont, XtCXftFont, XtRPointer, sizeof(XtPointer),
- offset(menu.renderFont), XtRPointer, (XtPointer) NULL },
+ {XtNxftFont, XtCXftFont, XtRString, sizeof(XtPointer),
+ offset(menu.xftFontName), XtRString, (XtPointer) "Helvetica-12:bold" },
#endif
# ifdef USE_XFONTSET
/* #### Consider using the same method as for Motif; see the comment in
@@ -3241,6 +3241,9 @@ XlwMenuInitialize (Widget UNUSED (reques
#endif
#ifdef USE_XFT_MENUBARS
+ /* #### kludge for name change */
+ if (!mw->menu.fcFontName)
+ mw->menu.fcFontName = mw->menu.xftFontName;
/* to do this right, we should add a new Xt Resource type +
conversion function
*/
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h
index b14fde9..b091399 100644
--- a/lwlib/xlwmenuP.h
+++ b/lwlib/xlwmenuP.h
@@ -35,6 +35,7 @@ typedef struct _XlwMenu_part
XFontStruct * font;
#ifdef USE_XFT_MENUBARS
String fcFontName;
+ String xftFontName;
XftFont *renderFont;
#endif
# ifdef USE_XFONTSET
diff --git a/lwlib/xlwtabs.c b/lwlib/xlwtabs.c
index b13f0b4..e99ee61 100644
--- a/lwlib/xlwtabs.c
+++ b/lwlib/xlwtabs.c
@@ -153,11 +153,11 @@ static XtResource resources[] = {
/* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here?
or XtDefaultFont? */
{XtNfcFontName, XtCFcFontName, XtRString, sizeof(String),
- offset(fcFontName), XtRString, (XtPointer) "AirCut-16" },
+ offset(fcFontName), XtRString, (XtPointer) NULL },
/* #### This needs to be fixed to give a proper type and converter for
XftFonts. See also xlwmenu.c. */
- {XtNxftFont, XtCXftFont, XtRPointer, sizeof(XtPointer),
- offset(renderFont), XtRPointer, (XtPointer) NULL },
+ {XtNxftFont, XtCXftFont, XtRString, sizeof(String),
+ offset(xftFontName), XtRString, (XtPointer) "Helvetica-12" },
#endif
{XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension),
offset(internalWidth), XtRImmediate, (XtPointer)4 },
@@ -479,10 +479,12 @@ TabsInit(Widget request, Widget new_, Ar
newTw->tabs.tab_height = 2 * newTw->tabs.internalHeight + SHADWID ;
#ifdef USE_XFT_TABS
+ /* #### kludge for name change */
+ if (!newTw->tabs.fcFontName)
+ newTw->tabs.fcFontName = newTw->tabs.xftFontName;
/* must get font here
- to do this right, we should add a new Xt Resource type +
- conversion function
- */
+ #### to do this right, we should add a new Xt Resource type +
+ conversion function */
newTw->tabs.renderFont =
xft_open_font_by_name (XtDisplay ((Widget) newTw),
newTw->tabs.fcFontName);
diff --git a/lwlib/xlwtabs.h b/lwlib/xlwtabs.h
index 3216556..3f9694c 100644
--- a/lwlib/xlwtabs.h
+++ b/lwlib/xlwtabs.h
@@ -44,8 +44,8 @@
Name Class RepType Default Value
---- ----- ------- -------------
font Font XFontStruct* XtDefaultFont
- fcFontName FcFontName String AirCut-16 *0
- xftFont XftFont XtPointer NULL *8
+ fcFontName FcFontName String NULL *0
+ xftFont XftFont String Helvetica-12 *8
internalWidth Width Dimension 4 *1
internalHeight Height Dimension 2 *1
topWidget TopWidget Widget *2
diff --git a/lwlib/xlwtabsP.h b/lwlib/xlwtabsP.h
index 9bc6e44..b99c9b2 100644
--- a/lwlib/xlwtabsP.h
+++ b/lwlib/xlwtabsP.h
@@ -76,6 +76,7 @@ typedef struct {
#ifdef USE_XFT_TABS
XftFont *renderFont;
String fcFontName;
+ String xftFontName;
#endif
Dimension internalHeight, internalWidth ;
Widget topWidget ;
diff --git a/man/ChangeLog b/man/ChangeLog
index ed67b60..f53bd76 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,11 @@
+2006-11-16 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ * internals/internals.texi
+ (Better Rendering Support -- Configuration with the Interim Patches):
+ Fix examples of configuration via X resources.
+ (Better Rendering Support -- Implementation): Fix description of
+ xftFont resources, introduce fcFontName resource.
+
2006-11-11 Aidan Kehoe <kehoea(a)parhasard.net>
* lispref/faces.texi (Face Convenience Functions):
diff --git a/man/internals/internals.texi b/man/internals/internals.texi
index 2f0df88..ca61879 100644
--- a/man/internals/internals.texi
+++ b/man/internals/internals.texi
@@ -27629,12 +27629,16 @@ of @file{Xft}'s rendering functionality
@item fontconfig
Fontconfig is dramatically different from the X model in several ways.
-In particular, @emph{fontconfig always returns a font}. However, the
+In particular, for the convenient interface @emph{fontconfig always
+returns a font}. However, the
font returned need not be anything like the desired font. This means
that XEmacs must adopt a strategy of delegating the search to
fontconfig, then sanity-checking the return, rather than trying to use
the fontconfig API to search using techniques appropriate for the X11
-core font API.
+core font API. (This isn't actually true. fontconfig has more complex
+interfaces which allow listing a subset of fonts that match a pattern,
+and don't go out of their may to return something no matter what. But
+the original patches didn't use this approach.)
@item Font menus
The @samp{Options->Font} and @samp{Options->Font Sizes} menus are
@@ -27647,17 +27651,20 @@ the size is strange. And the @samp{Opti
disabled, and has been for eons.
@item X resources
-Currently in Stephen's patch there are @emph{four} treatments of font
+Currently in Stephen's patch there are @emph{five} treatments of font
resources. There are the @samp{XEmacs.(a)var{face}.attributeFont}
resources used to set a single global font specification. In the
widgets, some (still) have a @samp{font} resource using the automatic
@file{Xt} resource conversion to @samp{FontStruct}, some have separate
-@samp{font} and @samp{xftFont} resources with the former automatically
+@samp{font} and @samp{fcFontName} resources with the former automatically
converted to @samp{FontStruct} by @file{Xt} and the latter left as a
-string, to be converted by @samp{XftParseName} later, and some have a
+string, to be converted by @samp{FcParseName} later, and some have a
single @samp{font} resource which is converted to @samp{FontStruct} by
@file{Xt} or the latter left as a string, depending on whether
-@file{Xft} was enabled by @samp{configure} or not.
+@file{Xft} was enabled by @samp{configure} or not. There is also the
+@samp{xftFont} resource which may be retargeted to use an Xt converter
+function, but currently simply just an alias for the @samp{fcFontName}
+resource.
Stephen thinks that all of these should be converted to use the face
approach, perhaps with some way to set specifications for individual
@@ -27894,8 +27901,12 @@ at best. Probably we will should to a s
this resource, and convert to a face in XEmacs rather than a font in
Xt/Xft.
@example
-XEmacs*Tabs.xftFont: Bitstream Vera Sans-16
-XEmacs*menubar*xftFont: Bitstream Vera Sans-16
+! DEPRECATED resource xftFont.
+! To be retargeted to an Xt converter which returns a font.
+!XEmacs*Tabs.xftFont: Bitstream Vera Sans-16
+!XEmacs*menubar*xftFont: Bitstream Vera Sans-16
+XEmacs*Tabs.fcFontName: Bitstream Vera Sans-16
+XEmacs*menubar*fcFontName: Bitstream Vera Sans-16
XEmacs.modeline.attributeFont: Bitstream Charter-16
XEmacs.default.attributeFont: Bitstream Vera Sans Mono-16
@end example
@@ -27903,7 +27914,14 @@ I highly recommend use of a proportional
allows a lot more text to fit there. (Previously the font sizes were
quite varied, and there was a comment that this weirdness gave good
balance. This isn't true on my main platform, Mac OS X, and needs to be
-rechecked on Linux, where it was observed.)
+rechecked on Linux, where it was observed.) Note that you can probably
+specify a particular Japanese font with something like
+@example
+XEmacs.default.attributeFont: Bitstream Vera Sans Mono,Sazanami Mincho-16
+@end example
+Order is important; Japanese fonts will support English, but Sazanami's
+Roman characters are not very pretty compared to the Bitstream font.
+@strong{Note:} @emph{This is untested, but should work in theory.}
@end itemize
**** End of patch
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta