fonts: fix textmetrics underline and strikeout

Huw D M Davies h.davies1 at physics.ox.ac.uk
Thu Jul 22 04:56:53 CDT 2004


        Huw Davies <huw at codeweavers.com>
        Make tmUnderlined and tmStruckOut reflect the values used to
        create the font.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/freetype.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/freetype.c,v
retrieving revision 1.62
diff -u -r1.62 freetype.c
--- dlls/gdi/freetype.c	14 Jul 2004 21:42:35 -0000	1.62
+++ dlls/gdi/freetype.c	22 Jul 2004 09:53:23 -0000
@@ -195,6 +195,8 @@
     int charset;
     BOOL fake_italic;
     BOOL fake_bold;
+    BYTE underline;
+    BYTE strikeout;
     INT orientation;
     GM *gm;
     DWORD gmsize;
@@ -1694,6 +1696,8 @@
 
     ret->orientation = lf.lfOrientation;
     ret->name = strdupW(family->FamilyName);
+    ret->underline = lf.lfUnderline ? 0xff : 0;
+    ret->strikeout = lf.lfStrikeOut ? 0xff : 0;
 
     TRACE("caching: gdiFont=%p  hfont=%p\n", ret, hfont);
     ret->hfont = hfont;
@@ -2482,8 +2486,8 @@
         TM.tmDefaultChar = winfnt_header.default_char;
         TM.tmBreakChar = winfnt_header.break_char;
         TM.tmItalic = winfnt_header.italic;
-        TM.tmUnderlined = winfnt_header.underline;
-        TM.tmStruckOut = winfnt_header.strike_out;
+        TM.tmUnderlined = font->underline;
+        TM.tmStruckOut = font->strikeout;
         TM.tmPitchAndFamily = winfnt_header.pitch_and_family;
         TM.tmCharSet = winfnt_header.charset;
     }
@@ -2506,8 +2510,8 @@
         TM.tmDefaultChar = 32;
         TM.tmBreakChar = 32;
         TM.tmItalic = ft_face->style_flags & FT_STYLE_FLAG_ITALIC ? 1 : 0;
-        TM.tmUnderlined = 0;
-        TM.tmStruckOut = 0;
+        TM.tmUnderlined = font->underline;
+        TM.tmStruckOut = font->strikeout;
         /* NB inverted meaning of TMPF_FIXED_PITCH */
         TM.tmPitchAndFamily = ft_face->face_flags & FT_FACE_FLAG_FIXED_WIDTH ? 0 : TMPF_FIXED_PITCH;
         TM.tmCharSet = font->charset;
@@ -2671,8 +2675,8 @@
     TM.tmDefaultChar = pOS2->usDefaultChar;
     TM.tmBreakChar = pOS2->usBreakChar ? pOS2->usBreakChar : ' ';
     TM.tmItalic = font->fake_italic ? 255 : ((ft_face->style_flags & FT_STYLE_FLAG_ITALIC) ? 255 : 0);
-    TM.tmUnderlined = 0; /* entry in OS2 table */
-    TM.tmStruckOut = 0; /* entry in OS2 table */
+    TM.tmUnderlined = font->underline;
+    TM.tmStruckOut = font->strikeout;
 
     /* Yes TPMF_FIXED_PITCH is correct; braindead api */
     if(!FT_IS_FIXED_WIDTH(ft_face))



More information about the wine-patches mailing list