usp10: Handle multi-glyph clusters in ScriptStringOut.

This commit is contained in:
Aric Stewart 2011-10-18 13:57:03 -05:00 committed by Alexandre Julliard
parent 1172b8102e
commit 0aa30c4673
1 changed files with 36 additions and 5 deletions

View File

@ -1263,6 +1263,21 @@ error:
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,
int iX,
int iY,
@ -1344,6 +1359,25 @@ static HRESULT SS_ItemOut( SCRIPT_STRING_ANALYSIS ssa,
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,
(SCRIPT_CACHE *)&analysis->glyphs[iItem].sc, iX + off_x,
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
for (glyph+=direction; glyph < cGlyphs && glyph >= 0; glyph +=direction)
{
if (pva[glyph].fClusterStart)
break;
for (i = 0; i < cChars; i++)
if (pwLogClust[i] == glyph) break;
if (i != cChars)
if (does_glyph_start_cluster(pva, pwLogClust, cChars, glyph, direction))
break;
if (glyph > log_clust_max)
break;