summaryrefslogtreecommitdiff
path: root/src/w32fns.c
diff options
context:
space:
mode:
authorAndrew Innes <andrewi@gnu.org>1998-11-03 22:21:58 +0000
committerAndrew Innes <andrewi@gnu.org>1998-11-03 22:21:58 +0000
commit1a292d24f1481eab918d6a46e22d1f75ed9322ee (patch)
tree3c3cb20a930988496401cc67033e13c6fee50be1 /src/w32fns.c
parentce8c28097dbde372bc2ab9f082ba160a7ffa42ad (diff)
downloademacs-1a292d24f1481eab918d6a46e22d1f75ed9322ee.tar.gz
(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.
Diffstat (limited to 'src/w32fns.c')
-rw-r--r--src/w32fns.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/src/w32fns.c b/src/w32fns.c
index 5b65821dbda..d269214b9ae 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;