From: Ziqing Hui <zhui@codeweavers.com> --- dlls/gdi32/tests/font.c | 1 - dlls/gdi32/text.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c index de0f44f9099..3d6264ca0a7 100644 --- a/dlls/gdi32/tests/font.c +++ b/dlls/gdi32/tests/font.c @@ -7085,7 +7085,6 @@ static void test_textout_missing_glyph(void) glyph_bitmap = create_textout_bitmap(hdc, &bmi, &rect, (const WCHAR *)glyphs, ARRAY_SIZE(glyphs), ETO_GLYPH_INDEX, &glyph_bits); - todo_wine ok(memcmp(text_bits, glyph_bits, rect.right * rect.bottom * 4), "Missing glyph text unexpectedly matched default glyph output.\n"); diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 0b58abe8ce1..c89dd3fe25d 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -337,6 +337,35 @@ static void BidiLines(int baselevel, LPWSTR pszOutLine, LPCWSTR pszLine, const W HeapFree(GetProcessHeap(), 0, run); } +static BOOL run_needs_font_linking(HDC hdc, const WCHAR *str, int count) +{ + BOOL ret = FALSE; + WORD *glyphs; + int i; + + if (!hdc) + return FALSE; + + if (!(glyphs = HeapAlloc(GetProcessHeap(), 0, count * sizeof(*glyphs)))) + return FALSE; + + if (NtGdiGetGlyphIndicesW(hdc, str, count, glyphs, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR) + { + for (i = 0; i < count; ++i) + { + /* Ignore control characters when checking for missing glyphs. */ + if (glyphs[i] == 0xffff && str[i] >= 32) + { + ret = TRUE; + break; + } + } + } + + HeapFree(GetProcessHeap(), 0, glyphs); + return ret; +} + /************************************************************* * BIDI_Reorder * @@ -647,6 +676,14 @@ static BOOL BIDI_Reorder( HDC hDC, /* [in] Display DC */ HeapFree(GetProcessHeap(), 0, *lpGlyphs); *lpGlyphs = NULL; } + else if (run_needs_font_linking(hDC, text, cChars)) + { + TRACE("Shaped run needs font linking\n"); + j = nItems; + doGlyphs = FALSE; + HeapFree(GetProcessHeap(), 0, *lpGlyphs); + *lpGlyphs = NULL; + } else { WORD *new_glyphs; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11232