Commit 0aa30c46 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

usp10: Handle multi-glyph clusters in ScriptStringOut.

parent 1172b810
...@@ -1263,6 +1263,21 @@ error: ...@@ -1263,6 +1263,21 @@ error:
return hr; return hr;
} }
static inline BOOL does_glyph_start_cluster(const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cChars, int glyph, int direction)
{
int i;
if (pva[glyph].fClusterStart)
return TRUE;
for (i = 0; i < cChars; i++)
if (pwLogClust[i] == glyph) break;
if (i != cChars)
return TRUE;
return FALSE;
}
static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa, static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
int iX, int iX,
int iY, int iY,
...@@ -1344,6 +1359,25 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa, ...@@ -1344,6 +1359,25 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
cGlyphs++; cGlyphs++;
if (cEnd < 0 || scriptInformation[analysis->pItem[iItem].a.eScript].props.fNeedsCaretInfo)
{
INT direction;
INT clust_glyph;
clust_glyph = iGlyph + cGlyphs;
if (analysis->pItem[iItem].a.fRTL)
direction = -1;
else
direction = 1;
while(clust_glyph < analysis->glyphs[iItem].numGlyphs &&
!does_glyph_start_cluster(analysis->glyphs[iItem].psva, analysis->glyphs[iItem].pwLogClust, (analysis->pItem[iItem+1].iCharPos - analysis->pItem[iItem].iCharPos), clust_glyph, direction))
{
cGlyphs++;
clust_glyph++;
}
}
hr = ScriptTextOut(analysis->hdc, hr = ScriptTextOut(analysis->hdc,
(SCRIPT_CACHE *)&analysis->glyphs[iItem].sc, iX + off_x, (SCRIPT_CACHE *)&analysis->glyphs[iItem].sc, iX + off_x,
iY, uOptions, prc, &analysis->pItem[iItem].a, NULL, 0, iY, uOptions, prc, &analysis->pItem[iItem].a, NULL, 0,
...@@ -1660,11 +1694,8 @@ static inline int get_glyph_cluster_advance(const int* piAdvance, const SCRIPT_V ...@@ -1660,11 +1694,8 @@ static inline int get_glyph_cluster_advance(const int* piAdvance, const SCRIPT_V
for (glyph+=direction; glyph < cGlyphs && glyph >= 0; glyph +=direction) for (glyph+=direction; glyph < cGlyphs && glyph >= 0; glyph +=direction)
{ {
if (pva[glyph].fClusterStart)
break; if (does_glyph_start_cluster(pva, pwLogClust, cChars, glyph, direction))
for (i = 0; i < cChars; i++)
if (pwLogClust[i] == glyph) break;
if (i != cChars)
break; break;
if (glyph > log_clust_max) if (glyph > log_clust_max)
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment