[PATCH v3 0/1] MR5893: uniscribe: Update ETO_GLYPH_INDEX flag even if script cache is freed.
If the script cache was already freed before ScriptTextOut() runs and hence the sfnt member is not available, use the definition from init_script_cache() to conditionally apply the ETO_GLYPH_INDEX flag. -- v3: gdi32/uniscribe: Ensure the cache is initialised. https://gitlab.winehq.org/wine/wine/-/merge_requests/5893
From: Danyil Blyschak <dblyschak(a)codeweavers.com> Call init_script_cache() in ScriptTextOut() to ensure that a cache exists for the logic around the ETO_GLYPH_INDEX flag. --- dlls/gdi32/uniscribe/usp10.c | 3 ++- dlls/usp10/tests/usp10.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/gdi32/uniscribe/usp10.c b/dlls/gdi32/uniscribe/usp10.c index 72e75224069..1fda1841533 100644 --- a/dlls/gdi32/uniscribe/usp10.c +++ b/dlls/gdi32/uniscribe/usp10.c @@ -3510,7 +3510,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN int iReserved, const WORD *pwGlyphs, int cGlyphs, const int *piAdvance, const int *piJustify, const GOFFSET *pGoffset) { - HRESULT hr = S_OK; + HRESULT hr; INT i, dir = 1; INT *lpDx; WORD *reordered_glyphs = (WORD *)pwGlyphs; @@ -3521,6 +3521,7 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN if (!hdc || !psc) return E_INVALIDARG; if (!piAdvance || !psa || !pwGlyphs) return E_INVALIDARG; + if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr; fuOptions &= ETO_CLIPPED | ETO_OPAQUE; fuOptions |= ETO_IGNORELANGUAGE; diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index 7516bfb2a97..92b26e56392 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -2777,6 +2777,7 @@ static void test_ScriptTextOut(HDC hdc) hr = ScriptTextOut(hdc, &psc, 0, 0, 0, NULL, &pItem[0].a, NULL, 0, pwOutGlyphs1, pcGlyphs, piAdvance, NULL, pGoffset); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(!!psc, "Got unexpected psc %p.\n", psc); /* Test Rect Rgn is acceptable. */ SetRect(&rect, 10, 10, 40, 20); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5893
Updated commit subject as well as the initialization of `hr` to `S_OK`. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5893#note_74376
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5893
participants (3)
-
Danyil Blyschak -
Danyil Blyschak (@blyss) -
Huw Davies (@huw)