Rémi Bernon : gdi32: Don't try to get glyph index when default char is 0.

Alexandre Julliard julliard at winehq.org
Tue Dec 8 15:38:14 CST 2020


Module: wine
Branch: master
Commit: 06206f1628be8e12164f097d985a7e20a3a3d0f1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=06206f1628be8e12164f097d985a7e20a3a3d0f1

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Dec  8 13:09:22 2020 +0100

gdi32: Don't try to get glyph index when default char is 0.

Fixes a regression from 5bdc6e0fe64222d8d7d383616f5e230928af011a, this
is what the code was originally doing.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50175
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/freetype.c   | 2 +-
 dlls/gdi32/tests/font.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 09c8251de8f..fffa3288503 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -2601,7 +2601,7 @@ static UINT CDECL freetype_get_default_glyph( struct gdi_font *font )
     if ((pOS2 = pFT_Get_Sfnt_Table( ft_face, ft_sfnt_os2 )))
     {
         UINT glyph = pOS2->usDefaultChar;
-        freetype_get_glyph_index( font, &glyph, TRUE );
+        if (glyph) freetype_get_glyph_index( font, &glyph, TRUE );
         return glyph;
     }
     if (!pFT_Get_WinFNT_Header( ft_face, &winfnt )) return winfnt.default_char + winfnt.first_char;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index cde83757c16..86ccddd05ea 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -1716,8 +1716,8 @@ static void test_GetGlyphIndices(void)
     testtext[0] = 'T';
     charcount = pGetGlyphIndicesW(hdc, testtext, (sizeof(testtext)/2)-1, glyphs, flags);
     ok(charcount == 5, "GetGlyphIndicesW count of glyphs should = 5 not %d\n", charcount);
-    todo_wine ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
-    todo_wine ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
+    ok(glyphs[0] == 0, "GetGlyphIndicesW for tmDefaultChar should be 0 not %04x\n", glyphs[0]);
+    ok(glyphs[4] == 0, "GetGlyphIndicesW should have returned 0 not %04x\n", glyphs[4]);
     DeleteObject(SelectObject(hdc, hOldFont));
 
     ret = pRemoveFontMemResourceEx(rsrc);




More information about the wine-cvs mailing list