]> code.delx.au - gnu-emacs/commitdiff
* w32fns.c (w32_load_system_font): Fix detecting FIXED_PITCH fonts.
authorJason Rumney <jasonr@gnu.org>
Thu, 31 May 2007 13:09:08 +0000 (13:09 +0000)
committerJason Rumney <jasonr@gnu.org>
Thu, 31 May 2007 13:09:08 +0000 (13:09 +0000)
(x_to_w32_font): Fill in lfPitchAndFamily correctly.

* w32fns.c [USE_FONT_BACKEND]: Port font backend changes from xfns.c.
(x_to_w32_charset, w32_to_x_charset): Expose externally.

src/w32fns.c

index 62a97c96fdd13b0d4fd466db6886ef2be1066c66..977d6a13333ddae4efeda9fa4b8e9170d1f868e6 100644 (file)
@@ -4707,7 +4707,7 @@ w32_load_system_font (f,fontname,size)
     fontp->name = (char *) xmalloc (strlen (fontname) + 1);
     bcopy (fontname, fontp->name, strlen (fontname) + 1);
 
-    if (lf.lfPitchAndFamily == FIXED_PITCH)
+    if ((lf.lfPitchAndFamily & 0x03) == FIXED_PITCH)
       {
        /* Fixed width font.  */
        fontp->average_width = fontp->space_width = FONT_WIDTH (font);
@@ -4725,7 +4725,6 @@ w32_load_system_font (f,fontname,size)
        fontp->average_width = font->tm.tmAveCharWidth;
       }
 
-
     fontp->charset = -1;
     charset = xlfd_charset_of_font (fontname);
 
@@ -5612,8 +5611,12 @@ x_to_w32_font (lpxstr, lplogfont)
        lplogfont->lfHeight = atoi (height) * dpi / 720;
 
       if (fields > 0)
-      lplogfont->lfPitchAndFamily =
-       (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH;
+        {
+          if (pitch == 'p')
+            lplogfont->lfPitchAndFamily = VARIABLE_PITCH | FF_DONTCARE;
+          else if (pitch == 'c')
+            lplogfont->lfPitchAndFamily = FIXED_PITCH | FF_DONTCARE;
+        }
 
       fields--;