Nikolay Sivov : usp10: Make sure metrics cache is used with glyph indices only.
Alexandre Julliard
julliard at winehq.org
Fri Dec 14 11:57:12 CST 2018
Module: wine
Branch: master
Commit: 8d018d8d1dadf9d731690567b9c98d5a9eae37db
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8d018d8d1dadf9d731690567b9c98d5a9eae37db
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Dec 14 02:55:38 2018 +0300
usp10: Make sure metrics cache is used with glyph indices only.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44410
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/usp10/usp10.c | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/dlls/usp10/usp10.c b/dlls/usp10/usp10.c
index c42b57d..a05de98 100644
--- a/dlls/usp10/usp10.c
+++ b/dlls/usp10/usp10.c
@@ -3416,35 +3416,41 @@ HRESULT WINAPI ScriptPlaceOpenType( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS
if (pABC) memset(pABC, 0, sizeof(ABC));
for (i = 0; i < cGlyphs; i++)
{
+ WORD glyph;
ABC abc;
+
+ /* FIXME: set to more reasonable values */
+ pGoffset[i].du = pGoffset[i].dv = 0;
+
if (pGlyphProps[i].sva.fZeroWidth)
{
abc.abcA = abc.abcB = abc.abcC = 0;
+ if (piAdvance) piAdvance[i] = 0;
+ continue;
+ }
+
+ if (psa->fNoGlyphIndex)
+ {
+ if (FAILED(hr = ScriptGetCMap(hdc, psc, &pwGlyphs[i], 1, 0, &glyph))) return hr;
}
- else if (!get_cache_glyph_widths(psc, pwGlyphs[i], &abc))
+ else
+ glyph = pwGlyphs[i];
+
+ if (!get_cache_glyph_widths(psc, glyph, &abc))
{
- BOOL ret;
if (!hdc) return E_PENDING;
if (get_cache_pitch_family(psc) & TMPF_TRUETYPE)
{
- 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;
+ if (!GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc)) return S_FALSE;
}
else
{
INT width;
- 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;
+ if (!GetCharWidthI(hdc, glyph, 1, NULL, &width)) return S_FALSE;
abc.abcB = width;
abc.abcA = abc.abcC = 0;
}
- set_cache_glyph_widths(psc, pwGlyphs[i], &abc);
+ set_cache_glyph_widths(psc, glyph, &abc);
}
if (pABC)
{
@@ -3452,8 +3458,6 @@ HRESULT WINAPI ScriptPlaceOpenType( HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS
pABC->abcB += abc.abcB;
pABC->abcC += abc.abcC;
}
- /* FIXME: set to more reasonable values */
- pGoffset[i].du = pGoffset[i].dv = 0;
if (piAdvance) piAdvance[i] = abc.abcA + abc.abcB + abc.abcC;
}
More information about the wine-cvs
mailing list