fonts: linking #4

Huw D M Davies h.davies1 at physics.ox.ac.uk
Wed Sep 7 04:55:46 CDT 2005


        Huw Davies <huw at codeweavers.com>
        get_glyph_index should return the nonexistent glyph for bitmap
        fonts when a unicode character cannot be represented as a single
        byte in the font's codepage.
-- 
Huw Davies
huw at codeweavers.com
Index: dlls/gdi/freetype.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/freetype.c,v
retrieving revision 1.95
diff -u -p -r1.95 freetype.c
--- dlls/gdi/freetype.c	7 Sep 2005 09:21:50 -0000	1.95
+++ dlls/gdi/freetype.c	7 Sep 2005 09:51:18 -0000
@@ -2468,9 +2468,15 @@ static FT_UInt get_glyph_index(GdiFont f
 {
     if(font->ft_face->charmap->encoding == FT_ENCODING_NONE) {
         WCHAR wc = (WCHAR)glyph;
+        BOOL default_used;
+        FT_UInt ret;
         char buf;
-        WideCharToMultiByte(font->codepage, 0, &wc, 1, &buf, sizeof(buf), 0, 0);
-        return pFT_Get_Char_Index(font->ft_face, (unsigned char)buf);
+        if(!WideCharToMultiByte(font->codepage, 0, &wc, 1, &buf, sizeof(buf), NULL, &default_used) || default_used)
+            ret = 0;
+        else
+            ret = pFT_Get_Char_Index(font->ft_face, (unsigned char)buf);
+        TRACE("%04x (%02x) -> ret %d def_used %d\n", glyph, buf, ret, default_used);
+        return ret;
     }
 
     if(font->charset == SYMBOL_CHARSET && glyph < 0x100)



More information about the wine-patches mailing list