From 10766458536772d2d37a97769b2b2b827331d271 Mon Sep 17 00:00:00 2001 From: kojima Date: Mon, 18 Oct 2004 02:30:22 +0000 Subject: [PATCH] changed default fonts improved font selection in wprefs --- WPrefs.app/FontSimple.c | 30 ++++++++++++++++++++++++++--- WindowMaker/Defaults/WMGLOBAL | 4 ++-- WindowMaker/Defaults/WindowMaker.in | 14 +++++++------- src/wconfig.h.in | 25 +++++++----------------- 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/WPrefs.app/FontSimple.c b/WPrefs.app/FontSimple.c index 3c10db90..bd74417b 100644 --- a/WPrefs.app/FontSimple.c +++ b/WPrefs.app/FontSimple.c @@ -325,13 +325,20 @@ static void selectedFamily(WMWidget *w, void *data) { _Panel *panel= (_Panel*)data; - WMListItem *item= WMGetListSelectedItem(panel->familyL); + WMListItem *item; + FontStyle *oldStyle= NULL; char buffer[1024]; + item= WMGetListSelectedItem(panel->styleL); + if (item) + oldStyle= (FontStyle*)item->clientData; + + item= WMGetListSelectedItem(panel->familyL); + if (item) { FontFamily *family= (FontFamily*)item->clientData; - int i; + int i, oldi= 0, oldscore= 0; WMClearList(panel->styleL); for (i = 0; i < family->stylen; i++) @@ -367,8 +374,25 @@ selectedFamily(WMWidget *w, void *data) item= WMAddListItem(panel->styleL, buffer); item->clientData= family->styles+i; + + if (oldStyle) { + int score= 0; + + if (oldStyle->width == family->styles[i].width) + score |= 1; + if (oldStyle->weight == family->styles[i].weight) + score |= 2; + if (oldStyle->slant == family->styles[i].slant) + score |= 4; + + if (score > oldscore) + { + oldi= i; + oldscore= score; + } + } } - WMSelectListItem(panel->styleL, 0); + WMSelectListItem(panel->styleL, oldi); { int index= WMGetPopUpButtonSelectedItem(panel->optionP); diff --git a/WindowMaker/Defaults/WMGLOBAL b/WindowMaker/Defaults/WMGLOBAL index 6eb067d7..54e8e44f 100644 --- a/WindowMaker/Defaults/WMGLOBAL +++ b/WindowMaker/Defaults/WMGLOBAL @@ -1,6 +1,6 @@ { - SystemFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=100"; - BoldSystemFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=200"; + SystemFont = "Trebuchet MS,Luxi Sans"; + BoldSystemFont = "Trebuchet MS,Luxi Sans:bold"; DefaultFontSize = 12; AntialiasedText = No; MultiByteText = AUTO; diff --git a/WindowMaker/Defaults/WindowMaker.in b/WindowMaker/Defaults/WindowMaker.in index 5fd28a0f..d954f745 100644 --- a/WindowMaker/Defaults/WindowMaker.in +++ b/WindowMaker/Defaults/WindowMaker.in @@ -105,13 +105,13 @@ ConstrainWindowSize = NO; ClipRaiseLowerKey = None; TitleJustify = center; - WindowTitleFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=200:pixelsize=12"; - MenuTitleFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=200:pixelsize=12"; - MenuTextFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=100:pixelsize=12"; - IconTitleFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=100:pixelsize=8"; - ClipTitleFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=200:pixelsize=10"; - DisplayFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=100:pixelsize=10"; - LargeDisplayFont = "Trebuchet MS,Luxi Sans,sans:slant=0:weight=200:pixelsize=24"; + WindowTitleFont = "Trebuchet MS,Luxi Sans:bold:pixelsize=12"; + MenuTitleFont = "Trebuchet MS,Luxi Sans:bold:pixelsize=12"; + MenuTextFont = "Trebuchet MS,Luxi Sans:pixelsize=12"; + IconTitleFont = "Trebuchet MS,Luxi Sans:pixelsize=8"; + ClipTitleFont = "Trebuchet MS,Luxi Sans:bold:pixelsize=10"; + DisplayFont = "Trebuchet MS,Luxi Sans:pixelsize=10"; + LargeDisplayFont = "Trebuchet MS,Luxi Sans:bold:pixelsize=24"; HighlightColor = white; HighlightTextColor = black; ClipTitleColor = black; diff --git a/src/wconfig.h.in b/src/wconfig.h.in index 2fa8b559..fa74e289 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -269,26 +269,15 @@ #define DEF_FRAME_COLOR "white" -#ifdef I18N -#define DEF_TITLE_FONT "\"-*-*-medium-r-normal--14-*\"" -#define DEF_MENU_TITLE_FONT "\"-*-*-medium-r-normal--14-*\"" -#define DEF_MENU_ENTRY_FONT "\"-*-*-medium-r-normal--14-*\"" -#define DEF_ICON_TITLE_FONT "\"-*-*-medium-r-normal--10-*\"" -#define DEF_CLIP_TITLE_FONT "\"-*-*-medium-r-normal--10-*\"" -#define DEF_INFO_TEXT_FONT "\"-*-*-medium-r-normal--14-*\"" -#define DEF_ADDITONAL_FONT "-*-*-medium-r-normal--12-*" +#define DEF_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=12" +#define DEF_MENU_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=12" +#define DEF_MENU_ENTRY_FONT "Trebuchet MS,Luxi Sans:pixelsize=12" +#define DEF_ICON_TITLE_FONT "Trebuchet MS,Luxi Sans:pixelsize=8" +#define DEF_CLIP_TITLE_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=10" +#define DEF_INFO_TEXT_FONT "Trebuchet MS,Luxi Sans:pixelsize=12" -#define DEF_WORKSPACE_NAME_FONT "\"-*-*-medium-r-normal--24-*\"" -#else /* !I18N */ -#define DEF_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\"" -#define DEF_MENU_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*\"" -#define DEF_MENU_ENTRY_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\"" -#define DEF_ICON_TITLE_FONT "\"-*-helvetica-medium-r-normal-*-8-*-*-*-*-*-*-*\"" -#define DEF_CLIP_TITLE_FONT "\"-*-helvetica-bold-r-normal-*-10-*-*-*-*-*-*-*\"" -#define DEF_INFO_TEXT_FONT "\"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*\"" +#define DEF_WORKSPACE_NAME_FONT "Trebuchet MS,Luxi Sans:bold:pixelsize=24" -#define DEF_WORKSPACE_NAME_FONT "\"-*-lucida-bold-r-*-*-24-*-*-*-*-*-*-*\"" -#endif /* !I18N */ #define DEF_FRAME_THICKNESS 1 /* linewidth of the move/resize frame */