Module: wine Branch: master Commit: f45606c5f8b95923d4f398034f86951a47a511a8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=f45606c5f8b95923d4f398034...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Jan 20 10:54:48 2021 +0000
gdi32: Avoid best fit chars when mapping unicode character to a glyph index.
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/gdi32/font.c | 6 +++--- dlls/gdi32/tests/font.c | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c index 6f50cc92a83..afd41aeec31 100644 --- a/dlls/gdi32/font.c +++ b/dlls/gdi32/font.c @@ -2906,11 +2906,11 @@ static UINT get_glyph_index( struct gdi_font *font, UINT glyph ) glyph = get_glyph_index_symbol( font, wc ); if (!glyph) { - if (WideCharToMultiByte( CP_ACP, 0, &wc, 1, &ch, 1, NULL, NULL )) + if (WideCharToMultiByte( CP_ACP, WC_NO_BEST_FIT_CHARS, &wc, 1, &ch, 1, NULL, NULL )) glyph = get_glyph_index_symbol( font, (unsigned char)ch ); } } - else if (WideCharToMultiByte( font->codepage, 0, &wc, 1, &ch, 1, NULL, &used ) && !used) + else if (WideCharToMultiByte( font->codepage, WC_NO_BEST_FIT_CHARS, &wc, 1, &ch, 1, NULL, &used ) && !used) { glyph = (unsigned char)ch; font_funcs->get_glyph_index( font, &glyph, FALSE ); @@ -3219,7 +3219,7 @@ static DWORD CDECL font_GetGlyphIndices( PHYSDEV dev, const WCHAR *str, INT coun if (str[i] >= 0xf020 && str[i] <= 0xf100) glyph = str[i] - 0xf000; else if (str[i] < 0x100) glyph = str[i]; } - else if (WideCharToMultiByte( physdev->font->codepage, 0, &str[i], 1, + else if (WideCharToMultiByte( physdev->font->codepage, WC_NO_BEST_FIT_CHARS, &str[i], 1, &ch, 1, NULL, &used ) && !used) glyph = (unsigned char)ch; } diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index da5fdf2238e..461eecf8038 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -1688,14 +1688,12 @@ static void test_GetGlyphIndices(void) charcount = GetGlyphIndicesW(hdc, c, ARRAY_SIZE(c), glyphs, GGI_MARK_NONEXISTING_GLYPHS); ok(charcount == ARRAY_SIZE(c), "got %u\n", charcount); ok(glyphs[0] == 0x001f || glyphs[0] == 0xffff /* Vista */, "got %#x\n", glyphs[0]); -todo_wine ok(glyphs[1] == 0x001f || glyphs[1] == 0xffff /* Vista */, "got %#x\n", glyphs[1]);
glyphs[0] = glyphs[1] = 0; charcount = GetGlyphIndicesW(hdc, c, ARRAY_SIZE(c), glyphs, 0); ok(charcount == ARRAY_SIZE(c), "got %u\n", charcount); ok(glyphs[0] == textm.tmDefaultChar || glyphs[0] == 0x20 /* CJK Windows */, "got %#x\n", glyphs[0]); -todo_wine ok(glyphs[1] == textm.tmDefaultChar || glyphs[1] == 0x20 /* CJK Windows */, "got %#x\n", glyphs[1]);
DeleteObject(SelectObject(hdc, hOldFont));