User: stephent
Date: 06/05/12 21:25:30
Modified: xemacs/lwlib ChangeLog lwlib-fonts.h xlwmenu.c xlwmenuP.h
xlwtabs.c xlwtabs.h xlwtabsP.h
Log:
Stop trashing xftFont resources. <87mzdnxd1j.fsf(a)tleepslib.sk.tsukuba.ac.jp>
Revision Changes Path
1.87 +20 -0 XEmacs/xemacs/lwlib/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/ChangeLog,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -p -r1.86 -r1.87
--- ChangeLog 2006/05/02 15:30:31 1.86
+++ ChangeLog 2006/05/12 19:25:28 1.87
@@ -1,3 +1,23 @@
+2006-05-12 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Make fcFontName and xftFont separate resources.
+
+ * lwlib-fonts.h (XtNfcFontName, XtCFcFontName): New macros.
+ (XtNxftFont, XtCXftFont): Coalesce the conditional definitions.
+
+ * xlwmenuP.h (XlwMenuPart):
+ * xlwtabsP.h (TabsPart):
+ Rename renderFontSpec member to fcFontName.
+
+ * xlwmenu.c (XlwMenuResources):
+ * xlwtabs.c (resources):
+ Add a record for fcFontName.
+
+ * xlwtabs.c (TabsInit): Use the fcFontName resource, not xftFont.
+
+ * xlwtabs.c (DrawTab,TabLayout,TabsGeometryManager): Improve
+ diagnostics.
+
2006-04-24 Jerry James <james(a)xemacs.org>
* lwlib-Xaw.c (lw_debug_print_class_resources): Casting from a
1.3 +4 -2 XEmacs/xemacs/lwlib/lwlib-fonts.h
Index: lwlib-fonts.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/lwlib-fonts.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- lwlib-fonts.h 2005/11/26 11:45:59 1.2
+++ lwlib-fonts.h 2006/05/12 19:25:29 1.3
@@ -48,9 +48,11 @@ Boston, MA 02111-1307, USA. */
#ifdef USE_XFT
#ifndef XtNxftFont
#define XtNxftFont "xftFont"
-#endif
-#ifndef XtCXftFont
#define XtCXftFont "XftFont"
+#endif
+#ifndef XtNfcFont
+#define XtNfcFontName "fcFontName"
+#define XtCFcFontName "FcFontName"
#endif
#endif /* USE_XFT */
1.41 +7 -3 XEmacs/xemacs/lwlib/xlwmenu.c
Index: xlwmenu.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwmenu.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -p -r1.40 -r1.41
--- xlwmenu.c 2006/05/02 15:30:32 1.40
+++ xlwmenu.c 2006/05/12 19:25:29 1.41
@@ -93,9 +93,13 @@ xlwMenuResources[] =
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(menu.font), XtRString, (XtPointer) "XtDefaultFont"},
#ifdef USE_XFT_MENUBARS
- {XtNxftFont, XtCXftFont, XtRString, sizeof (String),
- offset(menu.renderFontSpec),
+ {XtNfcFontName, XtCFcFontName, XtRString, sizeof (String),
+ offset(menu.fcFontName),
XtRString, (XtPointer) "Helvetica-12:bold"},
+ /* #### 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 },
#endif
# ifdef USE_XFONTSET
/* #### Consider using the same method as for Motif; see the comment in
@@ -3241,7 +3245,7 @@ XlwMenuInitialize (Widget UNUSED (reques
conversion function
*/
mw->menu.renderFont =
- xft_open_font_by_name (XtDisplay (mw), mw->menu.renderFontSpec);
+ xft_open_font_by_name (XtDisplay (mw), mw->menu.fcFontName);
#endif
make_drawing_gcs (mw);
1.6 +1 -2 XEmacs/xemacs/lwlib/xlwmenuP.h
Index: xlwmenuP.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwmenuP.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- xlwmenuP.h 2005/11/26 11:46:00 1.5
+++ xlwmenuP.h 2006/05/12 19:25:29 1.6
@@ -34,8 +34,7 @@ typedef struct _XlwMenu_part
#else
XFontStruct * font;
#ifdef USE_XFT_MENUBARS
- /* #### Fix naming convention here */
- String renderFontSpec;
+ String fcFontName;
XftFont *renderFont;
#endif
# ifdef USE_XFONTSET
1.8 +31 -24 XEmacs/xemacs/lwlib/xlwtabs.c
Index: xlwtabs.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwtabs.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- xlwtabs.c 2006/05/02 15:30:32 1.7
+++ xlwtabs.c 2006/05/12 19:25:29 1.8
@@ -150,10 +150,14 @@ static XtResource resources[] = {
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
offset(font), XtRString, (XtPointer) XtDefaultFont},
#ifdef USE_XFT_TABS
- /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here? */
- {XtNxftFont, XtCXftFont, XtRString, sizeof (String),
- offset(renderFontSpec), XtRString,
- (XtPointer) "AirCut-16" /* XtDefaultFont */},
+ /* #### Maybe use "-*-helvetica-bold-r-*-*-*-120-*-*-*-*-iso8859-1" here?
+ or XtDefaultFont? */
+ {XtNfcFontName, XtCFcFontName, XtRString, sizeof(String),
+ offset(fcFontName), XtRString, (XtPointer) "AirCut-16" },
+ /* #### 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 },
#endif
{XtNinternalWidth, XtCWidth, XtRDimension, sizeof(Dimension),
offset(internalWidth), XtRImmediate, (XtPointer)4 },
@@ -481,7 +485,7 @@ TabsInit(Widget request, Widget new_, Ar
*/
newTw->tabs.renderFont =
xft_open_font_by_name (XtDisplay ((Widget) newTw),
- newTw->tabs.renderFontSpec);
+ newTw->tabs.fcFontName);
if (newTw->tabs.renderFont != NULL)
#if XFT_USE_HEIGHT_NOT_ASCENT_DESCENT
newTw->tabs.tab_height += newTw->tabs.renderFont->height;
@@ -1089,7 +1093,7 @@ do { \
get triggered forever after */
int n = control->composite.num_children;
ah = control->tabs.tab_height;
- if (debug_tabs > 0)
+ if (debug_tabs > 1)
fprintf (stderr, "Kludging around %d != 1 rows,"
" #children = %d, total height %d, using %d.\n",
check_nrows, n, th, ah);
@@ -1616,7 +1620,7 @@ DrawTab(TabsWidget tw, Widget child, Boo
GC gc ;
int x,y ;
- if (debug_tabs > 1) fprintf (stderr, "DrawTab called.\n");
+ if (debug_tabs > 2) fprintf (stderr, "DrawTab called.\n");
if( !XtIsRealized((Widget)tw))
return ;
@@ -1712,7 +1716,6 @@ DrawTab(TabsWidget tw, Widget child, Boo
(int) strlen (lbl), &glyphinfo);
/* #### unnecessary? for the moment, give visual extent */
/* draw background rect */
-#if 1
if (debug_tabs > 2)
{
fprintf (stderr, "background color: pixel=%08lx, r=%04x,"
@@ -1725,19 +1728,16 @@ DrawTab(TabsWidget tw, Widget child, Boo
glyphinfo.x, glyphinfo.y, glyphinfo.xOff,
glyphinfo.yOff, glyphinfo.width, glyphinfo.height);
}
- XftDrawRect (xftDraw, &colorDBG,
- /* left, top, width, height */
- x+tab->tabs.l_x-glyphinfo.x,
- y+tab->tabs.l_y-glyphinfo.y,
- glyphinfo.width, glyphinfo.height);
-#endif
- /* draw text */
if (debug_tabs > 2)
+ XftDrawRect (xftDraw, &colorDBG,
+ /* left, top, width, height */
+ x+tab->tabs.l_x-glyphinfo.x,
+ y+tab->tabs.l_y-glyphinfo.y,
+ glyphinfo.width, glyphinfo.height);
+
+ /* draw text */
+ if (debug_tabs > 1)
{
- FcValue name;
- FcValue size;
- FcPatternGet (renderFont->pattern, FC_FAMILY, 0, &name);
- FcPatternGet (renderFont->pattern, FC_SIZE, 0, &size);
fprintf (stderr, "label: %s.\n", lbl);
fprintf (stderr, "foreground color: pixel=%08lx, r=%04x,"
" g=%04x, b=%04x, alpha=%04x.\n",
@@ -1747,6 +1747,13 @@ DrawTab(TabsWidget tw, Widget child, Boo
" yOffset=%d, height=%d, width=%d.\n",
glyphinfo.x, glyphinfo.y, glyphinfo.xOff,
glyphinfo.yOff, glyphinfo.height, glyphinfo.width);
+ }
+ if (debug_tabs > 0)
+ {
+ FcValue name;
+ FcValue size;
+ FcPatternGet (renderFont->pattern, FC_FAMILY, 0, &name);
+ FcPatternGet (renderFont->pattern, FC_SIZE, 0, &size);
fprintf (stderr, "font: name=%s-%.1f,"
" height=%d, ascent=%d, descent=%d.\n",
name.u.s, size.u.d, renderFont->height,
@@ -2065,11 +2072,11 @@ TabLayout(TabsWidget tw,
/* If wid or hgt is 0, we want to guess our own dimensions.
Currently the guessing functions are broken....
#### When PreferredSize*() get fixed, fix this too. */
- if (debug_tabs > 0)
+ if (debug_tabs > 1)
fprintf (stderr, "arg=%d,", wid);
wid = (wid ? wid : tw->core.width) - INDENT ;
hgt = hgt ? hgt : tw->core.height;
- if (debug_tabs > 0)
+ if (debug_tabs > 1)
fprintf (stderr, "wid=%d: x,w,y=", wid);
for(i=num_children, childP=tw->composite.children; --i >= 0; ++childP)
if( XtIsManaged(*childP) )
@@ -2077,7 +2084,7 @@ TabLayout(TabsWidget tw,
tab = (TabsConstraints) (*childP)->core.constraints ;
w = tab->tabs.width ;
- if (debug_tabs > 0)
+ if (debug_tabs > 1)
fprintf (stderr, "%d,%d,%d;", x, w, y);
if( x + w > wid ) { /* new row */
/* #### algorithm is not robust to wid < child's width */
@@ -2100,7 +2107,7 @@ TabLayout(TabsWidget tw,
tab->tabs.visible = 1;
}
- if (debug_tabs > 0)
+ if (debug_tabs > 1)
fprintf (stderr, "\n");
/* If there was only one row, increase the height by TABDELTA */
if( ++display_rows == 1 )
@@ -2127,7 +2134,7 @@ TabLayout(TabsWidget tw,
tw->tabs.realRows = row;
}
- if (debug_tabs > 0 && (row > 1 || display_rows > 1))
+ if (debug_tabs > 1 && (row > 1 || display_rows > 1))
fprintf (stderr, "tab: %d display rows, #children = %d,"
" total height %d, total rows %d%s.\n",
display_rows, num_children, y, row,
1.3 +13 -9 XEmacs/xemacs/lwlib/xlwtabs.h
Index: xlwtabs.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwtabs.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -r1.2 -r1.3
--- xlwtabs.h 2001/04/12 18:21:57 1.2
+++ xlwtabs.h 2006/05/12 19:25:29 1.3
@@ -44,16 +44,18 @@
Name Class RepType Default Value
---- ----- ------- -------------
font Font XFontStruct* XtDefaultFont
- internalWidth Width Dimension 4 *1
- internalHeight Height Dimension 2 *1
- topWidget TopWidget Widget *2
- callback Callback XtCallbackList NULL *3
- popdownCallback Callback XtCallbackList NULL *4
- selectInsensitive SelectInsensitive Boolean True *5
- beNiceToColormap BeNiceToColormap Boolean False *6
+ fcFontName FcFontName String AirCut-16 *0
+ xftFont XftFont XtPointer NULL *8
+ internalWidth Width Dimension 4 *1
+ internalHeight Height Dimension 2 *1
+ topWidget TopWidget Widget *2
+ callback Callback XtCallbackList NULL *3
+ popdownCallback Callback XtCallbackList NULL *4
+ selectInsensitive SelectInsensitive Boolean True *5
+ beNiceToColormap BeNiceToColormap Boolean False *6
topShadowContrast TopShadowContrast int 20
bottomShadowContrast BottomShadowContrast int 40
- insensitiveContrast InsensitiveContrast int 33 *7
+ insensitiveContrast InsensitiveContrast int 33 *7
background Background Pixel XtDefaultBackground
border BorderColor Pixel XtDefaultForeground
@@ -70,6 +72,7 @@
Notes:
+ 0 this is a joke, it will be changed.
1 internalWidth, internalHeight specify the margins around the text
in the tabs.
2 topWidget identifies the widget which is currently visible.
@@ -82,7 +85,8 @@
be selected anyway.
6 BeNiceToColormap causes the Tabs widget to use fewer colors.
7 InsensitiveContrast sets the contrast used for labels of insensitive widgets.
-
+ 8 fcFontName and xftFont are separate resources because there is not yet
+ registered representation and converter for XftFonts.
*/
/* Constraint parameters:
1.4 +3 -3 XEmacs/xemacs/lwlib/xlwtabsP.h
Index: xlwtabsP.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lwlib/xlwtabsP.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- xlwtabsP.h 2005/11/26 11:46:00 1.3
+++ xlwtabsP.h 2006/05/12 19:25:29 1.4
@@ -74,8 +74,8 @@ typedef struct {
/* resources */
XFontStruct *font ;
#ifdef USE_XFT_TABS
- String renderFontSpec;
- XftFont *renderFont;
+ XftFont *renderFont;
+ String fcFontName;
#endif
Dimension internalHeight, internalWidth ;
Widget topWidget ;
@@ -122,7 +122,7 @@ typedef struct _TabsRec {
/****************************************************************
*
- * constraint record declaration
+ * Constraint record declaration
*
****************************************************************/