changeset 23620:2b55b8f8cdc1

(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.
author Andrew Innes <andrewi@gnu.org>
date Tue, 03 Nov 1998 22:21:58 +0000
parents 0813c9bb52c4
children 82325b2dbb5e
files src/w32fns.c
diffstat 1 files changed, 33 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32fns.c	Tue Nov 03 10:25:56 1998 +0000
+++ b/src/w32fns.c	Tue Nov 03 22:21:58 1998 +0000
@@ -4502,29 +4502,29 @@
 
     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);
-    }
-
-  UNBLOCK_INPUT;
+    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;
 
     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 @@
 {
   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 @@
 #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 @@
   
   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 @@
   lplogfont->lfQuality = PROOF_QUALITY;
 #endif
 
+  lplogfont->lfCharSet = DEFAULT_CHARSET;
+  lplogfont->lfWeight = FW_DONTCARE;
+  lplogfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
+
   if (!lpxstr)
     return FALSE;