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.
-- v2: uniscribe: Update ETO_GLYPH_INDEX flag even if script cache is freed.
From: Danyil Blyschak dblyschak@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 | 1 + dlls/usp10/tests/usp10.c | 1 + 2 files changed, 2 insertions(+)
diff --git a/dlls/gdi32/uniscribe/usp10.c b/dlls/gdi32/uniscribe/usp10.c index 72e75224069..233f2a3dc83 100644 --- a/dlls/gdi32/uniscribe/usp10.c +++ b/dlls/gdi32/uniscribe/usp10.c @@ -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);
Pushed commit that calls init_script_cache() instead, and also updates the test.
Could you change the commit subject to be something like: `gdi32/uniscribe: Ensure the cache is initialised.`?
There's now no reason to init `hr` to `S_OK`, so that can be removed.