1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

added a runtime disabling of multibyte text support

This commit is contained in:
kojima
1999-05-30 02:23:58 +00:00
parent bdd18ccdf0
commit c8cbc630c4
6 changed files with 47 additions and 20 deletions

View File

@@ -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:

View File

@@ -162,6 +162,7 @@ typedef struct W_Screen {
WMHashTable *fontCache;
Bool useMultiByte;
struct W_Balloon *balloon;
@@ -331,6 +332,7 @@ typedef struct W_EventHandler {
typedef struct _WINGsConfiguration {
char *systemFont;
char *boldSystemFont;
Bool useMultiByte;
unsigned doubleClickDelay;
} _WINGsConfiguration;

View File

@@ -32,6 +32,9 @@ W_ReadConfigurations(void)
WINGsConfiguration.boldSystemFont =
WMGetUDStringForKey(defaults, "BoldSystemFont");
WINGsConfiguration.useMultiByte =
WMGetUDStringForKey(defaults, "MultiByteText");
WINGsConfiguration.doubleClickDelay =
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
}

View File

@@ -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,14 +161,22 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size)
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
if (WINGsConfiguration.useMultiByte)
font = WMCreateFont(scrPtr, fontSpec);
else
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
if (!font) {
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!");
free(fontSpec);
@@ -187,14 +197,22 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
if (WINGsConfiguration.useMultiByte)
font = WMCreateFont(scrPtr, fontSpec);
else
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
if (!font) {
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!");
free(fontSpec);

View File

@@ -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);

View File

@@ -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);