diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index 576ad06c..512d1ac4 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -39,6 +39,8 @@ changes since wmaker 0.53.0: - added WMGetColorPanelColor(WMColorPanel *panel) - made WMGetUDStringForKey() to only return a reference to the string, not a wstrdup()'ed copy. DO NOT FREE IT ANYMORE! +- added MultiByteText option to userdefaults file to control use of multibyte + string drawing functions changes since wmaker 0.52.0: diff --git a/WINGs/WINGsP.h b/WINGs/WINGsP.h index 35a0f776..8bc4eb27 100644 --- a/WINGs/WINGsP.h +++ b/WINGs/WINGsP.h @@ -155,13 +155,14 @@ typedef struct W_Screen { GC ixorGC; /* IncludeInferiors XOR */ GC textFieldGC; - + W_Font *normalFont; W_Font *boldFont; WMHashTable *fontCache; + Bool useMultiByte; struct W_Balloon *balloon; @@ -317,11 +318,11 @@ typedef struct W_View { typedef struct W_EventHandler { unsigned long eventMask; - + WMEventProc *proc; - + void *clientData; - + struct W_EventHandler *nextHandler; } W_EventHandler; @@ -331,6 +332,7 @@ typedef struct W_EventHandler { typedef struct _WINGsConfiguration { char *systemFont; char *boldSystemFont; + Bool useMultiByte; unsigned doubleClickDelay; } _WINGsConfiguration; diff --git a/WINGs/configuration.c b/WINGs/configuration.c index 776ec363..384fdf0f 100644 --- a/WINGs/configuration.c +++ b/WINGs/configuration.c @@ -31,9 +31,12 @@ W_ReadConfigurations(void) WINGsConfiguration.boldSystemFont = WMGetUDStringForKey(defaults, "BoldSystemFont"); - + + WINGsConfiguration.useMultiByte = + WMGetUDStringForKey(defaults, "MultiByteText"); + WINGsConfiguration.doubleClickDelay = - WMGetUDIntegerForKey(defaults, "DoubleClickTime"); + WMGetUDIntegerForKey(defaults, "DoubleClickTime"); } if (!WINGsConfiguration.systemFont) { diff --git a/WINGs/wfont.c b/WINGs/wfont.c index 86883a84..a2393b48 100644 --- a/WINGs/wfont.c +++ b/WINGs/wfont.c @@ -101,6 +101,8 @@ WMCreateFontInDefaultEncoding(WMScreen *scrPtr, char *fontName) font->refCount = 1; + font->name = wstrdup(fontName); + assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL); return font; @@ -159,13 +161,21 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size) fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size); - font = WMCreateFont(scrPtr, fontSpec); + if (WINGsConfiguration.useMultiByte) + font = WMCreateFont(scrPtr, fontSpec); + else + font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec); if (!font) { - wwarning("could not load font set %s. Trying fixed.", fontSpec); - font = WMCreateFont(scrPtr, "fixed"); - if (!font) { - font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); + if (WINGsConfiguration.useMultiByte) { + wwarning("could not load font set %s. Trying fixed.", fontSpec); + font = WMCreateFont(scrPtr, "fixed"); + if (!font) { + font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); + } + } else { + wwarning("could not load font %s. Trying fixed.", fontSpec); + font = WMCreateFontInDefaultEncoding(scrPtr, "fixed"); } if (!font) { wwarning("could not load fixed font!"); @@ -187,13 +197,21 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size) fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size); - font = WMCreateFont(scrPtr, fontSpec); - + if (WINGsConfiguration.useMultiByte) + font = WMCreateFont(scrPtr, fontSpec); + else + font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec); + if (!font) { - wwarning("could not load font set %s. Trying fixed.", fontSpec); - font = WMCreateFont(scrPtr, "fixed"); - if (!font) { - font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); + if (WINGsConfiguration.useMultiByte) { + wwarning("could not load font set %s. Trying fixed.", fontSpec); + font = WMCreateFont(scrPtr, "fixed"); + if (!font) { + font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); + } + } else { + wwarning("could not load font %s. Trying fixed.", fontSpec); + font = WMCreateFontInDefaultEncoding(scrPtr, "fixed"); } if (!font) { wwarning("could not load fixed font!"); diff --git a/WINGs/widgets.c b/WINGs/widgets.c index 42ab1d13..950f39fb 100644 --- a/WINGs/widgets.c +++ b/WINGs/widgets.c @@ -596,6 +596,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context) scrPtr->stipple = stipple; + scrPtr->useMultiByte = WINGsConfiguration.useMultiByte; + scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 12); scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 12); diff --git a/WINGs/wtest.c b/WINGs/wtest.c index 83d2200c..6b3732fc 100644 --- a/WINGs/wtest.c +++ b/WINGs/wtest.c @@ -154,7 +154,7 @@ testGradientButtons(WMScreen *scr) WMSetButtonAltImage(btn, pix2); WMSetButtonText(btn, "Button"); - WMSetBalloonTextForView("This is another button", WMWidgetView(btn)); + WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn)); btn = WMCreateButton(win, WBTMomentaryChange); WMResizeWidget(btn, 60, 24); @@ -486,14 +486,14 @@ int main(int argc, char **argv) * Put the testSomething() function you want to test here. */ + testGradientButtons(scr); - testColorWell(scr); #if 0 + testColorWell(scr); testTabView(scr); testTextField(scr); - testGradientButtons(scr); testOpenFilePanel(scr); testFontPanel(scr);