Take monospace fonts into account in default font selectionalgorithm.

Mike Hearn mike at navi.cx
Sat Aug 7 10:20:11 CDT 2004


On Sat, 2004-08-07 at 23:16 +0900, Dmitry Timoshkov wrote:
> This can't work because instead of logical boolean results you compare
> binary flags which are different:
> 
> #define FT_FACE_FLAG_FIXED_WIDTH       ( 1L <<  2 )
> 
> #define MONO_FONT           0x08

You are right. I will watch out for this in future! Here is a fixed
patch.

Mike Hearn <mike at navi.cx>
Take monospace fonts into account in default font selection algorithm.

Index: dlls/gdi/freetype.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/freetype.c,v
retrieving revision 1.65
diff -u -r1.65 freetype.c
--- dlls/gdi/freetype.c	6 Aug 2004 17:31:39 -0000	1.65
+++ dlls/gdi/freetype.c	7 Aug 2004 15:07:23 -0000
@@ -168,7 +168,7 @@
     BOOL Bold;
     FONTSIGNATURE fs;
     FT_Fixed font_version;
-    BOOL scalable;
+    BOOL scalable, fixed_width;
     Bitmap_Size size;     /* set if face is a bitmap */
     BOOL external; /* TRUE if we should manually add this font to the registry */
     struct tagFace *next;
@@ -529,6 +529,8 @@
                 (*insertface)->scalable = FALSE;
             }
 
+            (*insertface)->fixed_width = (ft_face->face_flags & FT_FACE_FLAG_FIXED_WIDTH) ? TRUE : FALSE;
+
             memset(&(*insertface)->fs, 0, sizeof((*insertface)->fs));
 
             pOS2 = pFT_Get_Sfnt_Table(ft_face, ft_sfnt_os2);
@@ -1717,9 +1719,12 @@
 	}
     }
 
+    /* match on charset and style */
     if(!family) {
         for(family = FontList; family; family = family->next) {
-	    if(csi.fs.fsCsb[0] & family->FirstFace->fs.fsCsb[0])
+            
+	    if((csi.fs.fsCsb[0] & family->FirstFace->fs.fsCsb[0]) &&
+               (family->FirstFace->fixed_width == (lf.lfPitchAndFamily & MONO_FONT ? TRUE : FALSE)))
                 if(family->FirstFace->scalable || can_use_bitmap)
                     break;
 	}
@@ -1731,6 +1736,8 @@
 	FIXME("just using first face for now\n");
     }
 
+    TRACE("Using family %s\n", debugstr_w(family->FamilyName));
+    
     it = lf.lfItalic ? 1 : 0;
     bd = lf.lfWeight > 550 ? 1 : 0;
 





More information about the wine-patches mailing list