Module: wine Branch: master Commit: 4b22953ec5ce44b41e1f913d67549bff488f5ab0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4b22953ec5ce44b41e1f913d67...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Sun Feb 19 18:16:37 2017 +0100
usp10: Properly get glyph widths for OpenType fonts in ScriptPlaceOpenType().
I.e., don't use GetCharWidth32W() with glyph indices. This fixes glyph advances for OpenType fonts in wordpad.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Aric Stewart aric@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/usp10/usp10.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c index 3595ca2..f8a6aa5 100644 --- a/dlls/usp10/usp10.c +++ b/dlls/usp10/usp10.c @@ -3347,15 +3347,24 @@ HRESULT WINAPI ScriptPlaceOpenType( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS } else if (!get_cache_glyph_widths(psc, pwGlyphs[i], &abc)) { + BOOL ret; if (!hdc) return E_PENDING; - if ((get_cache_pitch_family(psc) & TMPF_TRUETYPE) && !psa->fNoGlyphIndex) + if (get_cache_pitch_family(psc) & TMPF_TRUETYPE) { - if (!GetCharABCWidthsI(hdc, 0, 1, (WORD *)&pwGlyphs[i], &abc)) return S_FALSE; + if (psa->fNoGlyphIndex) + ret = GetCharABCWidthsW(hdc, pwGlyphs[i], pwGlyphs[i], &abc); + else + ret = GetCharABCWidthsI(hdc, 0, 1, (WORD *)&pwGlyphs[i], &abc); + if (!ret) return S_FALSE; } else { INT width; - if (!GetCharWidth32W(hdc, pwGlyphs[i], pwGlyphs[i], &width)) return S_FALSE; + if (psa->fNoGlyphIndex) + ret = GetCharWidth32W(hdc, pwGlyphs[i], pwGlyphs[i], &width); + else + ret = GetCharWidthI(hdc, 0, 1, (WORD *)&pwGlyphs[i], &width); + if (!ret) return S_FALSE; abc.abcB = width; abc.abcA = abc.abcC = 0; }