Hello. It seems that the trouble was in side effects of setting GC font. If someone can explain me, why exactly problem appears, I will appreciate.
Second patch is for modules/, first does not affect them. Please not that it is for released fvwm 2.4.4 and it is much less tested than first one, may be someone should revise it accurately Also all STRICTLY_FIXED parts of fvwm code would be removed from the code (since nobody guarantee us that 'fixed' has character set that matches our locale). Third patch is a small modification to modules also. (substitution of XCreateFonSet of GetFonSetOrFixed) Fourth patch is GetFontSetOrFixed modification, which I emphatically ask you to accept.
Index: fvwm/builtins.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/builtins.c,v retrieving revision 1.331 diff -u -r1.331 builtins.c --- fvwm/builtins.c 2002/01/16 21:21:29 1.331 +++ fvwm/builtins.c 2002/01/23 21:12:47 @@ -1205,7 +1205,11 @@ int cset = Scr.DefaultColorset; /* make GC's */ +# ifdef I18N_MB gcm = GCFunction|GCFont|GCLineWidth|GCForeground|GCBackground; +# else + gcm = GCFunction|GCLineWidth|GCForeground|GCBackground; +# endif gcv.function = GXcopy; gcv.font = Scr.DefaultFont.font->fid; gcv.line_width = 0; Index: fvwm/menus.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/menus.c,v retrieving revision 1.286 diff -u -r1.286 menus.c --- fvwm/menus.c 2002/01/23 15:20:00 1.286 +++ fvwm/menus.c 2002/01/23 21:13:20 @@ -6177,7 +6177,11 @@ } /* make GC's */ +# ifdef I18N_MB + gcm = GCFunction|GCLineWidth|GCForeground|GCBackground; +# else gcm = GCFunction|GCFont|GCLineWidth|GCForeground|GCBackground; +# endif gcv.font = ST_PSTDFONT(ms)->font->fid; gcv.function = GXcopy; gcv.line_width = 0; Index: fvwm/misc.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/fvwm/misc.c,v retrieving revision 1.118 diff -u -r1.118 misc.c --- fvwm/misc.c 2002/01/01 19:09:56 1.118 +++ fvwm/misc.c 2002/01/23 21:13:21 @@ -369,10 +369,13 @@ /* some fancy font handling stuff */ void NewFontAndColor(Font newfont, Pixel color, Pixel backcolor) { - Globalgcv.font = newfont; Globalgcv.foreground = color; Globalgcv.background = backcolor; - Globalgcm = GCFont | GCForeground | GCBackground; +# ifdef I18N_MB + Globalgcm = GCForeground | GCBackground; +# else + Globalgcm = GCFont |GCForeground | GCBackground; +# endif XChangeGC(dpy,Scr.TitleGC,Globalgcm,&Globalgcv); } Index: libs/GetFont.c =================================================================== RCS file: /home/cvs/fvwm/fvwm/libs/GetFont.c,v retrieving revision 1.8 diff -u -r1.8 GetFont.c --- libs/GetFont.c 2001/12/30 21:21:23 1.8 +++ libs/GetFont.c 2002/01/23 21:13:22 @@ -51,48 +51,49 @@ } #ifdef I18N_MB -/* -** loads fontset or "fixed" on failure -** Note, STRICTLY_FIXED does not seem to be defined on a standard compile. -** The fallback is to a font that does not use a font alias. -** I'm not sure why this is done for I18N_MB only. dje Dec 2001. -*/ - -#ifdef STRICTLY_FIXED -#define FALLBACK_FONT "fixed" -#else -#define FALLBACK_FONT "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*" -#endif - XFontSet GetFontSetOrFixed(Display *disp, char *fontname) { XFontSet fontset = NULL; char **ml; int mc; + int i; char *ds; - if (fontname) + if (fontname){ fontset = XCreateFontSet(disp,fontname,&ml,&mc,&ds); - if (!fontset && fontname) - { - fprintf(stderr, + } + else{ + fprintf(stderr, "[FVWM][GetFontSetOrFixed]: " - "WARNING -- can't get fontset %s, trying '%s'\n", - fontname,FALLBACK_FONT); + "WARNING -- fontname is a NULL-string\n"); } if (!fontset) { + fprintf(stderr, + "[FVWM][GetFontSetOrFixed]: " + "WARNING -- can't get fontset '%s', trying '-*-fixed-*'\n", + fontname); /* fixed should always be avail, so try that */ - /* Yes, you say it's not a *FIXED* font, but it helps you. */ if ((fontset = XCreateFontSet(disp, - FALLBACK_FONT, + "-*-fixed-*", &ml, &mc, &ds)) == NULL) { fprintf(stderr,"[FVWM][GetFontSetOrFixed]: " - "ERROR -- can't get fontset '%s'\n",FALLBACK_FONT); + "ERROR -- can't get fontset 'fixed'\n"); + } + } + if (fontset){ + if (mc > 0) { + (void)fprintf(stderr, + "[FVWM][GetFontSetOrFixed]:" + "The following charsets are missing:\n"); + for(i=0; i < mc; i++) + fprintf(stderr, "\t%s\n", ml[i]); + XFreeStringList(ml); } } + return fontset; } #endif @@ -115,6 +116,7 @@ ret_font->font = fs_list[0]; fset_extents = XExtentsOfFontSet(newfontset); ret_font->height = fset_extents->max_logical_extent.height; + } else {
diff -ur modules.orig/FvwmButtons/FvwmButtons.c modules/FvwmButtons/FvwmButtons.c --- modules.orig/FvwmButtons/FvwmButtons.c Sun Dec 16 21:13:11 2001 +++ modules/FvwmButtons/FvwmButtons.c Thu Jan 24 01:45:36 2002 @@ -2054,11 +2054,13 @@ gcm = GCForeground|GCBackground; gcv.foreground = fore_pix; gcv.background = back_pix; +# ifndef I18N_MB if(ub && ub->c && ub->c->font && ub->font) { gcv.font = ub->c->font->fid; gcm |= GCFont; } +# endif NormalGC = fvwmlib_XCreateGC(Dpy, MyWindow, gcm, &gcv); gcv.foreground = shadow_pix; gcv.background = fore_pix; diff -ur modules.orig/FvwmButtons/draw.c modules/FvwmButtons/draw.c --- modules.orig/FvwmButtons/draw.c Thu Dec 13 10:55:27 2001 +++ modules/FvwmButtons/draw.c Thu Jan 24 01:45:12 2002 @@ -371,7 +371,11 @@ { gcv.foreground = fc; gcv.font = font->fid; +# ifdef I18N_MB + XChangeGC(Dpy,NormalGC,GCForeground,&gcv); +# else XChangeGC(Dpy,NormalGC,GCForeground | GCFont,&gcv); +# endif DrawTitle(b,MyWindow,NormalGC); } } /* title */ diff -ur modules.orig/FvwmForm/FvwmForm.c modules/FvwmForm/FvwmForm.c --- modules.orig/FvwmForm/FvwmForm.c Sun Oct 14 22:22:56 2001 +++ modules/FvwmForm/FvwmForm.c Thu Jan 24 01:49:17 2002 @@ -633,7 +633,11 @@ static void CheckAlloc(Item *this_item,DrawTable *dt) { static XGCValues xgcv; +# ifdef I18N_MB + static int xgcv_mask = GCBackground | GCForeground; +# else static int xgcv_mask = GCBackground | GCForeground | GCFont; +# endif if (dt->dt_used == 2) { /* fonts colors shadows */ return; @@ -665,7 +669,11 @@ xgcv.foreground = dt->dt_colors[c_item_fg]; xgcv.background = dt->dt_colors[c_item_bg]; xgcv.font = dt->dt_font; +# ifdef I18N_MB + dt->dt_item_GC = fvwmlib_XCreateGC(dpy, CF.frame, GCForeground, &xgcv); +# else dt->dt_item_GC = fvwmlib_XCreateGC(dpy, CF.frame, GCForeground | GCFont, &xgcv); +# endif if (Pdepth < 2) { dt->dt_colors[c_itemlo] = BlackPixel(dpy, screen); dt->dt_colors[c_itemhi] = WhitePixel(dpy, screen); diff -ur modules.orig/FvwmIconBox/FvwmIconBox.c modules/FvwmIconBox/FvwmIconBox.c --- modules.orig/FvwmIconBox/FvwmIconBox.c Sun Sep 16 19:51:17 2001 +++ modules/FvwmIconBox/FvwmIconBox.c Thu Jan 24 01:49:35 2002 @@ -1184,7 +1184,11 @@ gcv.foreground = icon_shadow_pix; IconShadowGC = fvwmlib_XCreateGC(dpy, main_win, gcm, &gcv); +# ifdef I18N_MB + gcm = GCForeground|GCBackground; +# else gcm = GCForeground|GCBackground|GCFont; +# endif gcv.foreground = icon_fore_pix; gcv.font = font->fid; NormalGC = fvwmlib_XCreateGC(dpy, main_win, gcm, &gcv); diff -ur modules.orig/FvwmIdent/FvwmIdent.c modules/FvwmIdent/FvwmIdent.c --- modules.orig/FvwmIdent/FvwmIdent.c Sun Sep 16 19:51:18 2001 +++ modules/FvwmIdent/FvwmIdent.c Thu Jan 24 01:47:48 2002 @@ -562,7 +562,11 @@ XSelectInput(dpy, main_win, mw_events); change_window_name(&MyName[1]); +# ifdef I18N_MB + gcm = GCForeground; +# else gcm = GCForeground|GCFont; +# endif gcv.foreground = fore_pix; gcv.font = font->fid; gc = fvwmlib_XCreateGC(dpy, main_win, gcm, &gcv); diff -ur modules.orig/FvwmPager/x_pager.c modules/FvwmPager/x_pager.c --- modules.orig/FvwmPager/x_pager.c Sun Dec 9 17:00:26 2001 +++ modules/FvwmPager/x_pager.c Thu Jan 24 01:47:28 2002 @@ -675,7 +675,11 @@ : Colorset[Desks[i].colorset].fg; gcv.font = font->fid; Desks[i].NormalGC = +# ifdef I18N_MB + fvwmlib_XCreateGC(dpy, Scr.Pager_w, GCForeground, &gcv); +# else fvwmlib_XCreateGC(dpy, Scr.Pager_w, GCForeground | GCFont, &gcv); +# endif /* create the active desk hilite GC */ if(Pdepth < 2) @@ -693,7 +697,11 @@ gcv.foreground = (Desks[i].highcolorset < 0) ? fore_pix : Colorset[Desks[i].highcolorset].fg; Desks[i].rvGC = +# ifdef I18N_MB + fvwmlib_XCreateGC(dpy, Scr.Pager_w, GCForeground, &gcv); +# else fvwmlib_XCreateGC(dpy, Scr.Pager_w, GCForeground | GCFont, &gcv); +# endif /* create the virtual page boundary GC */ gcv.foreground = (Desks[i].colorset < 0) ? fore_pix @@ -920,7 +928,11 @@ : Colorset[Desks[i].ballooncolorset].fg; Desks[i].BalloonGC = fvwmlib_XCreateGC(dpy, Desks[i].balloon.w, +# ifdef I18N_MB + GCForeground, &gcv); +# else GCFont | GCForeground, &gcv); +# endif /* don't do this yet, wait for map since size will change if (Desks[i].ballooncolorset > -1 && Colorset[Desks[i].ballooncolorset].pixmap) diff -ur modules.orig/FvwmTaskBar/ButtonArray.c modules/FvwmTaskBar/ButtonArray.c --- modules.orig/FvwmTaskBar/ButtonArray.c Fri Nov 10 21:09:45 2000 +++ modules/FvwmTaskBar/ButtonArray.c Thu Jan 24 01:44:12 2002 @@ -223,7 +223,7 @@ int search_len; XFontStruct *font; #ifdef I18N_MB - XFontSet fontset; + XFontSet fontset SelButtonFontset; #endif XGCValues gcv; unsigned long gcm; @@ -244,28 +244,15 @@ if (state != BUTTON_UP) { x++; y++; } if (state == BUTTON_BRIGHT || button == StartButton) -#ifdef I18N_MB - { font = SelButtonFont; - fontset = SelButtonFontset; - } -#else - font = SelButtonFont; -#endif else -#ifdef I18N_MB - { - font = ButtonFont; - fontset = ButtonFontset; - } -#else font = ButtonFont; -#endif +# ifdef I18N_MB gcm = GCFont; gcv.font = font->fid; XChangeGC(dpy, *drawgc, gcm, &gcv); - +# endif newx = 4; w3p = XTextWidth(font, t3p, 3); diff -ur modules.orig/FvwmTaskBar/FvwmTaskBar.c modules/FvwmTaskBar/FvwmTaskBar.c --- modules.orig/FvwmTaskBar/FvwmTaskBar.c Sun Sep 16 19:51:19 2001 +++ modules/FvwmTaskBar/FvwmTaskBar.c Thu Jan 24 01:44:44 2002 @@ -1656,7 +1656,11 @@ gcval.font = SelButtonFont->fid; gcval.graphics_exposures = False; +# ifdef I18N_MB + gcmask = GCForeground | GCBackground | GCGraphicsExposures; +# else gcmask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; +# endif /* Normal */ gcval.foreground = pfore; if (graph) diff -ur modules.orig/FvwmTaskBar/Goodies.c modules/FvwmTaskBar/Goodies.c --- modules.orig/FvwmTaskBar/Goodies.c Sun Sep 16 19:51:19 2001 +++ modules/FvwmTaskBar/Goodies.c Thu Jan 24 01:40:21 2002 @@ -115,7 +115,11 @@ pfore = fore; pback = back; } +# ifdef I18N_MB + gcmask = GCForeground | GCBackground | GCGraphicsExposures; +# else gcmask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; +# endif gcval.foreground = pfore; gcval.background = pback; gcval.font = StatusFont->fid; diff -ur modules.orig/FvwmWharf/stepgfx.c modules/FvwmWharf/stepgfx.c --- modules.orig/FvwmWharf/stepgfx.c Sun Dec 3 18:56:09 2000 +++ modules/FvwmWharf/stepgfx.c Thu Jan 24 01:46:13 2002 @@ -524,7 +524,11 @@ gcv.foreground = 0; gcv.function = GXcopy; gcv.font = font->fid; +# ifdef I18N_MB + gc = fvwmlib_XCreateGC(dpy,mask,GCFunction|GCForeground,&gcv); +# else gc = fvwmlib_XCreateGC(dpy,mask,GCFunction|GCForeground|GCFont,&gcv); +# endif XFillRectangle(dpy,mask,gc,0,0,w,h); XSetForeground(dpy,gc,1); XDrawString(dpy,mask,gc,0,font->ascent,text,chars); diff -ur modules.orig/FvwmWinList/ButtonArray.c modules/FvwmWinList/ButtonArray.c --- modules.orig/FvwmWinList/ButtonArray.c Sun Nov 19 02:47:10 2000 +++ modules/FvwmWinList/ButtonArray.c Thu Jan 24 01:48:29 2002 @@ -407,9 +407,11 @@ bottomgc = up ? shadow[set] : hilite[set]; font = ButtonFont; +# ifndef I18N_MB gcm = GCFont; gcv.font = font->fid; XChangeGC(dpy, graph[set], gcm, &gcv); +# endif Fontheight=ButtonFont->ascent+ButtonFont->descent; diff -ur modules.orig/FvwmWinList/FvwmWinList.c modules/FvwmWinList/FvwmWinList.c --- modules.orig/FvwmWinList/FvwmWinList.c Tue Oct 2 19:31:01 2001 +++ modules/FvwmWinList/FvwmWinList.c Thu Jan 24 01:48:08 2002 @@ -1281,7 +1281,11 @@ gcval.foreground=fore[i]; gcval.background=back[i]; gcval.font=ButtonFont->fid; +# ifdef I18N_MB + gcmask=GCForeground|GCBackground; +# else gcmask=GCForeground|GCBackground|GCFont; +# endif graph[i]=fvwmlib_XCreateGC(dpy,win,gcmask,&gcval); if(Pdepth < 2)
diff -ur modules.orig/FvwmButtons/FvwmButtons.c modules/FvwmButtons/FvwmButtons.c --- modules.orig/FvwmButtons/FvwmButtons.c Thu Jan 24 03:00:45 2002 +++ modules/FvwmButtons/FvwmButtons.c Thu Jan 24 03:19:25 2002 @@ -1581,7 +1581,7 @@ if(strncasecmp(b->font_string,"none",4)==0) b->font=NULL; #ifdef I18N_MB - else if(!(b->fontset=XCreateFontSet(Dpy,b->font_string,&ml,&mc,&ds))) + else if(!(b->fontset=GetFontSetOrFixed(Dpy,b->font_string))) { b->font = NULL; b->flags&=~b_Font; @@ -1612,29 +1612,12 @@ if(strncasecmp(b->c->font_string,"none",4)==0) b->c->font=NULL; #ifdef I18N_MB - else if(!(b->c->fontset=XCreateFontSet(Dpy,b->c->font_string,&ml,&mc,&ds))) + else if(!(b->c->fontset=GetFontSetOrFixed(Dpy,b->c->font_string))) { fprintf(stderr,"%s: Couldn't load fontset %s\n",MyName, b->c->font_string); - if(b==UberButton) - { -#ifdef STRICTLY_FIXED - if(!(b->c->fontset=XCreateFontSet(Dpy,"fixed",&ml,&mc,&ds))) - { -#else - if(!(b->c->fontset=XCreateFontSet( - Dpy,"-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*",&ml,&mc,&ds))) - { -#endif - fprintf(stderr,"%s: Couldn't load fontset fixed\n",MyName); - b->c->font = NULL; - } - } - else - { b->c->font = NULL; b->c->flags&=~b_Font; - } } else { diff -ur modules.orig/FvwmPager/x_pager.c modules/FvwmPager/x_pager.c --- modules.orig/FvwmPager/x_pager.c Thu Jan 24 03:00:45 2002 +++ modules/FvwmPager/x_pager.c Thu Jan 24 03:32:32 2002 @@ -332,13 +332,9 @@ if (!uselabel || ((fontset = XCreateFontSet(dpy, font_string, &ml, &mc, &ds)) == NULL)) { -#ifdef STRICTLY_FIXED - if ((fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, &ds)) == NULL) -#else if ((fontset = - XCreateFontSet(dpy, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*", + XCreateFontSet(dpy, "-*-fixed-*", &ml, &mc, &ds)) == NULL) -#endif { fprintf(stderr,"%s: No fonts available\n",MyName); exit(1); @@ -367,7 +363,8 @@ #ifdef I18N_MB if(smallFont != NULL) { - windowFontset = XCreateFontSet(dpy, smallFont, &ml, &mc, &ds); + if ( (windowFontset = XCreateFontSet(dpy, smallFont, &ml, &mc, &ds)) == NULL) + windowFontset = XCreateFontSet(dpy, "-*-fixed-*", &ml, &mc, &ds); if (windowFontset != NULL) { XFontsOfFontSet(windowFontset, &fs_list, &ml); @@ -859,23 +856,9 @@ /* get font for balloon */ #ifdef I18N_MB - if ( (Desks[i].balloon.fontset = XCreateFontSet(dpy, BalloonFont, &ml, - &mc, &ds)) == NULL ) { -#ifdef STRICTLY_FIXED - if ( (Desks[i].balloon.fontset = XCreateFontSet(dpy, "fixed", &ml, &mc, - &ds)) == NULL ) -#else - if ( (Desks[i].balloon.fontset = - XCreateFontSet(dpy, - "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*", - &ml, &mc, &ds)) == NULL ) -#endif - { + if ( (Desks[i].balloon.fontset = GetFontSetOrFixed(dpy, BalloonFont)) == NULL ) { fprintf(stderr,"%s: No fonts available.\n", MyName); exit(1); - } - fprintf(stderr, "%s: Can't find font '%s', using fixed.\n", - MyName, BalloonFont); } XFontsOfFontSet(Desks[i].balloon.fontset, &fs_list, &ml); Desks[i].balloon.font = fs_list[0]; Only in modules/FvwmPager: x_pager.c~
--- libs/GetFont.c.orig Tue Dec 5 18:22:40 2000 +++ libs/GetFont.c Wed Jan 23 19:37:35 2002 @@ -59,38 +59,43 @@ XFontSet fontset = NULL; char **ml; int mc; + int i; char *ds; - if (fontname) + if (fontname){ fontset = XCreateFontSet(disp,fontname,&ml,&mc,&ds); - if (!fontset && fontname) - { - fprintf(stderr, + } + else{ + fprintf(stderr, "[FVWM][GetFontSetOrFixed]: " - "WARNING -- can't get fontset %s, trying 'fixed'\n", + "WARNING -- fontname is a NULL-string\n", fontname); } if (!fontset) { + fprintf(stderr, + "[FVWM][GetFontSetOrFixed]: " + "WARNING -- can't get fontset '%s', trying '-*-fixed-*'\n", + fontname); /* fixed should always be avail, so try that */ -#ifdef STRICTLY_FIXED - if ((fontset = XCreateFontSet(disp,"fixed",&ml,&mc,&ds))==NULL) - { - fprintf(stderr, - "[FVWM][GetFontSetOrFixed]: " - "ERROR -- can't get fontset 'fixed'\n"); - } -#else - /* Yes, you say it's not a *FIXED* font, but it helps you. */ if ((fontset = XCreateFontSet(disp, - "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*", + "-*-fixed-*", &ml, &mc, &ds)) == NULL) { fprintf(stderr,"[FVWM][GetFontSetOrFixed]: " "ERROR -- can't get fontset 'fixed'\n"); } -#endif + } + if (fontset){ + if (mc > 0) { + (void)fprintf(stderr, + "[FVWM][GetFontSetOrFixed]:" + "The following charsets are missing:\n"); + for(i=0; i < mc; i++) + fprintf(stderr, "\t%s\n", ml[i]); + XFreeStringList(ml); + } } return fontset;
-- Alexander Kotelnikov Saint-Petersburg, Russia