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>
This commit is contained in:
Henri Verbeet 2017-02-19 18:16:37 +01:00 committed by Alexandre Julliard
parent b47de18ce1
commit 4b22953ec5
1 changed files with 12 additions and 3 deletions

View File

@ -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;
}