From b65d0b96ce31c0e9f1cfbbe34fa4c4a822e8d74f Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 16 Jul 2012 07:24:02 -0500 Subject: [PATCH] usp10: In ScriptTextOut make use of piAdvance and pGoffset to position glyphs. --- dlls/usp10/usp10.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 0b535993755..9659e663474 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -3176,6 +3176,8 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN const int *piJustify, const GOFFSET *pGoffset) { HRESULT hr = S_OK; + INT i; + INT *lpDx; TRACE("(%p, %p, %d, %d, %04x, %p, %p, %p, %d, %p, %d, %p, %p, %p)\n", hdc, psc, x, y, fuOptions, lprc, psa, pwcReserved, iReserved, pwGlyphs, cGlyphs, @@ -3189,6 +3191,45 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN if (!psa->fNoGlyphIndex) /* Have Glyphs? */ fuOptions |= ETO_GLYPH_INDEX; /* Say don't do translation to glyph */ + lpDx = heap_alloc(cGlyphs * sizeof(INT) * 2); + + if (pGoffset) + { + for (i = 0; i < cGlyphs; i++) + if (!(fuOptions&ETO_PDY) && pGoffset[i].dv) + fuOptions |= ETO_PDY; + } + for (i = 0; i < cGlyphs; i++) + { + int idx = i; + if (fuOptions&ETO_PDY) + { + idx *=2; + lpDx[idx+1] = 0; + } + lpDx[idx] = piAdvance[i]; + } + if (pGoffset) + { + for (i = 1; i < cGlyphs; i++) + { + int idx = i; + int prev_idx = i-1; + if (fuOptions&ETO_PDY) + { + idx*=2; + prev_idx = idx-2; + } + lpDx[prev_idx] += pGoffset[i].du; + lpDx[idx] -= pGoffset[i].du; + if (fuOptions&ETO_PDY) + { + lpDx[prev_idx+1] += pGoffset[i].dv; + lpDx[idx+1] -= pGoffset[i].dv; + } + } + } + if (psa->fRTL && psa->fLogicalOrder) { int i; @@ -3201,14 +3242,16 @@ HRESULT WINAPI ScriptTextOut(const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UIN for (i = 0; i < cGlyphs; i++) rtlGlyphs[i] = pwGlyphs[cGlyphs-1-i]; - if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, rtlGlyphs, cGlyphs, NULL)) + if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, rtlGlyphs, cGlyphs, lpDx)) hr = S_FALSE; heap_free(rtlGlyphs); } else - if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, pwGlyphs, cGlyphs, NULL)) + if (!ExtTextOutW(hdc, x, y, fuOptions, lprc, pwGlyphs, cGlyphs, lpDx)) hr = S_FALSE; + heap_free(lpDx); + return hr; } -- 2.11.4.GIT