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) - added WMGetColorPanelColor(WMColorPanel *panel)
- made WMGetUDStringForKey() to only return a reference to the string, not a - made WMGetUDStringForKey() to only return a reference to the string, not a
wstrdup()'ed copy. DO NOT FREE IT ANYMORE! 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: changes since wmaker 0.52.0:

View File

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

View File

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

View File

@@ -101,6 +101,8 @@ WMCreateFontInDefaultEncoding(WMScreen *scrPtr, char *fontName)
font->refCount = 1; font->refCount = 1;
font->name = wstrdup(fontName);
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL); assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
return font; return font;
@@ -159,13 +161,21 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size)
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size); fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
font = WMCreateFont(scrPtr, fontSpec); if (WINGsConfiguration.useMultiByte)
font = WMCreateFont(scrPtr, fontSpec);
else
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
if (!font) { if (!font) {
wwarning("could not load font set %s. Trying fixed.", fontSpec); if (WINGsConfiguration.useMultiByte) {
font = WMCreateFont(scrPtr, "fixed"); wwarning("could not load font set %s. Trying fixed.", fontSpec);
if (!font) { font = WMCreateFont(scrPtr, "fixed");
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); 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) { if (!font) {
wwarning("could not load fixed font!"); wwarning("could not load fixed font!");
@@ -187,13 +197,21 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size); fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
font = WMCreateFont(scrPtr, fontSpec); if (WINGsConfiguration.useMultiByte)
font = WMCreateFont(scrPtr, fontSpec);
else
font = WMCreateFontInDefaultEncoding(scrPtr, fontSpec);
if (!font) { if (!font) {
wwarning("could not load font set %s. Trying fixed.", fontSpec); if (WINGsConfiguration.useMultiByte) {
font = WMCreateFont(scrPtr, "fixed"); wwarning("could not load font set %s. Trying fixed.", fontSpec);
if (!font) { font = WMCreateFont(scrPtr, "fixed");
font = WMCreateFont(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*"); 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) { if (!font) {
wwarning("could not load fixed font!"); wwarning("could not load fixed font!");

View File

@@ -596,6 +596,8 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
scrPtr->stipple = stipple; scrPtr->stipple = stipple;
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 12); scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 12);
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 12); scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 12);

View File

@@ -154,7 +154,7 @@ testGradientButtons(WMScreen *scr)
WMSetButtonAltImage(btn, pix2); WMSetButtonAltImage(btn, pix2);
WMSetButtonText(btn, "Button"); WMSetButtonText(btn, "Button");
WMSetBalloonTextForView("This is another button", WMWidgetView(btn)); WMSetBalloonTextForView("Este é outro balão.", WMWidgetView(btn));
btn = WMCreateButton(win, WBTMomentaryChange); btn = WMCreateButton(win, WBTMomentaryChange);
WMResizeWidget(btn, 60, 24); WMResizeWidget(btn, 60, 24);
@@ -486,14 +486,14 @@ int main(int argc, char **argv)
* Put the testSomething() function you want to test here. * Put the testSomething() function you want to test here.
*/ */
testGradientButtons(scr);
testColorWell(scr);
#if 0 #if 0
testColorWell(scr);
testTabView(scr); testTabView(scr);
testTextField(scr); testTextField(scr);
testGradientButtons(scr);
testOpenFilePanel(scr); testOpenFilePanel(scr);
testFontPanel(scr); testFontPanel(scr);