changeset 3685:382b11fa8866

[xemacs-hg @ 2006-11-17 02:50:22 by stephent] Fix breakage in xftFont resource for tabs and menubar. <877ixuiy0n.fsf@uwakimon.sk.tsukuba.ac.jp>
author stephent
date Fri, 17 Nov 2006 02:50:32 +0000
parents 80b10d0ec1e1
children 5bab930875e2
files lwlib/ChangeLog lwlib/xlwmenu.c lwlib/xlwmenuP.h lwlib/xlwtabs.c lwlib/xlwtabs.h lwlib/xlwtabsP.h man/ChangeLog man/internals/internals.texi
diffstat 8 files changed, 68 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lwlib/ChangeLog	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/ChangeLog	Fri Nov 17 02:50:32 2006 +0000
@@ -1,3 +1,18 @@
+2006-11-17  Stephen J. Turnbull  <stephen@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@xemacs.org>
 
 	* lwlib-Xlw.c (xlw_scrollbar_callback): Do not dereference
--- a/lwlib/xlwmenu.c	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/xlwmenu.c	Fri Nov 17 02:50:32 2006 +0000
@@ -95,11 +95,11 @@
 #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 @@
 #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
   */
--- a/lwlib/xlwmenuP.h	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/xlwmenuP.h	Fri Nov 17 02:50:32 2006 +0000
@@ -35,6 +35,7 @@
   XFontStruct *	font;
 #ifdef USE_XFT_MENUBARS
   String fcFontName;
+  String xftFontName;
   XftFont *renderFont;
 #endif
 # ifdef USE_XFONTSET
--- a/lwlib/xlwtabs.c	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/xlwtabs.c	Fri Nov 17 02:50:32 2006 +0000
@@ -153,11 +153,11 @@
   /* #### 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 @@
     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);
--- a/lwlib/xlwtabs.h	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/xlwtabs.h	Fri Nov 17 02:50:32 2006 +0000
@@ -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
--- a/lwlib/xlwtabsP.h	Thu Nov 16 22:51:09 2006 +0000
+++ b/lwlib/xlwtabsP.h	Fri Nov 17 02:50:32 2006 +0000
@@ -76,6 +76,7 @@
 #ifdef USE_XFT_TABS
     XftFont	*renderFont;
     String	fcFontName;
+    String	xftFontName;
 #endif
     Dimension   internalHeight, internalWidth ;
     Widget	topWidget ;
--- a/man/ChangeLog	Thu Nov 16 22:51:09 2006 +0000
+++ b/man/ChangeLog	Fri Nov 17 02:50:32 2006 +0000
@@ -1,3 +1,11 @@
+2006-11-16  Stephen J. Turnbull  <stephen@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@parhasard.net>
 
 	* lispref/faces.texi (Face Convenience Functions):
--- a/man/internals/internals.texi	Thu Nov 16 22:51:09 2006 +0000
+++ b/man/internals/internals.texi	Fri Nov 17 02:50:32 2006 +0000
@@ -27629,12 +27629,16 @@
 
 @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 @@
 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.@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 @@
 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 @@
 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