From 1a292d24f1481eab918d6a46e22d1f75ed9322ee Mon Sep 17 00:00:00 2001 From: Andrew Innes Date: Tue, 3 Nov 1998 22:21:58 +0000 Subject: [PATCH] (x_to_w32_font): Specify DEFAULT_CHARSET in the w32 LOGFONT struct if x font doesn't specify the charset. (x_to_w32_charset): Change >= to == when testing results of stricmp. --- src/w32fns.c | 59 ++++++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 27 deletions(-) diff --git a/src/w32fns.c b/src/w32fns.c index 5b65821dbd..d269214b9a 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4502,29 +4502,29 @@ int size; font->hfont = CreateFontIndirect (&lf); - if (font->hfont == NULL) - { - ok = FALSE; - } - else - { - HDC hdc; - HANDLE oldobj; - - hdc = GetDC (dpyinfo->root_window); - oldobj = SelectObject (hdc, font->hfont); - ok = GetTextMetrics (hdc, &font->tm); - SelectObject (hdc, oldobj); - ReleaseDC (dpyinfo->root_window, hdc); - } + if (font->hfont == NULL) + { + ok = FALSE; + } + else + { + HDC hdc; + HANDLE oldobj; + + hdc = GetDC (dpyinfo->root_window); + oldobj = SelectObject (hdc, font->hfont); + ok = GetTextMetrics (hdc, &font->tm); + SelectObject (hdc, oldobj); + ReleaseDC (dpyinfo->root_window, hdc); + } - UNBLOCK_INPUT; + UNBLOCK_INPUT; if (!ok) { - w32_unload_font (dpyinfo, font); - return (NULL); -} + w32_unload_font (dpyinfo, font); + return (NULL); + } /* Do we need to create the table? */ if (dpyinfo->font_table_size == 0) @@ -4722,14 +4722,14 @@ x_to_w32_charset (lpcs) { if (!lpcs) return (0); - if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; - else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; - else if (stricmp (lpcs, "symbol") >= 0) return SYMBOL_CHARSET; - else if (stricmp (lpcs, "jis") >= 0) return SHIFTJIS_CHARSET; + if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; + else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; + else if (stricmp (lpcs, "symbol") == 0) return SYMBOL_CHARSET; + else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET; else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; - else if (stricmp (lpcs, "oem") >= 0) return OEM_CHARSET; + else if (stricmp (lpcs, "oem") == 0) return OEM_CHARSET; #ifdef EASTEUROPE_CHARSET else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; @@ -4747,10 +4747,10 @@ x_to_w32_charset (lpcs) #endif #ifdef UNICODE_CHARSET - else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; - else if (stricmp (lpcs, "unicode") >= 0) return UNICODE_CHARSET; + else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; + else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; #endif - else if (lpcs[0] == '#') return atoi (lpcs + 1); + else if (lpcs[0] == '#') return atoi (lpcs + 1); else return DEFAULT_CHARSET; } @@ -4872,6 +4872,7 @@ x_to_w32_font (lpxstr, lplogfont) memset (lplogfont, 0, sizeof (*lplogfont)); + /* Set default value for each field. */ #if 1 lplogfont->lfOutPrecision = OUT_DEFAULT_PRECIS; lplogfont->lfClipPrecision = CLIP_DEFAULT_PRECIS; @@ -4883,6 +4884,10 @@ x_to_w32_font (lpxstr, lplogfont) lplogfont->lfQuality = PROOF_QUALITY; #endif + lplogfont->lfCharSet = DEFAULT_CHARSET; + lplogfont->lfWeight = FW_DONTCARE; + lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; + if (!lpxstr) return FALSE; -- 2.20.1