usp10: Rewrite ScriptStringCPtoX to make use of ScriptCPtoX.
This commit is contained in:
parent
289005a79f
commit
d7ea24d56d
|
@ -202,6 +202,7 @@ typedef struct {
|
||||||
SCRIPT_VISATTR* psva;
|
SCRIPT_VISATTR* psva;
|
||||||
GOFFSET* pGoffset;
|
GOFFSET* pGoffset;
|
||||||
ABC* abc;
|
ABC* abc;
|
||||||
|
int iMaxPosX;
|
||||||
} StringGlyphs;
|
} StringGlyphs;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -824,6 +825,7 @@ HRESULT WINAPI ScriptStringAnalyse(HDC hdc, const void *pString, int cString,
|
||||||
analysis->glyphs[i].psva = psva;
|
analysis->glyphs[i].psva = psva;
|
||||||
analysis->glyphs[i].pGoffset = pGoffset;
|
analysis->glyphs[i].pGoffset = pGoffset;
|
||||||
analysis->glyphs[i].abc = abc;
|
analysis->glyphs[i].abc = abc;
|
||||||
|
analysis->glyphs[i].iMaxPosX= -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*pssa = analysis;
|
*pssa = analysis;
|
||||||
|
@ -932,11 +934,9 @@ HRESULT WINAPI ScriptStringOut(SCRIPT_STRING_ANALYSIS ssa,
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int* pX)
|
HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int* pX)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
int runningX = 0;
|
int runningX = 0;
|
||||||
int runningCp = 0;
|
|
||||||
StringAnalysis* analysis = ssa;
|
StringAnalysis* analysis = ssa;
|
||||||
BOOL itemTrailing;
|
|
||||||
|
|
||||||
TRACE("(%p), %d, %d, (%p)\n", ssa, icp, fTrailing, pX);
|
TRACE("(%p), %d, %d, (%p)\n", ssa, icp, fTrailing, pX);
|
||||||
|
|
||||||
|
@ -950,27 +950,37 @@ HRESULT WINAPI ScriptStringCPtoX(SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrai
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<analysis->numItems; i++)
|
for(i=0; i<analysis->numItems; i++)
|
||||||
|
{
|
||||||
|
int CP = analysis->pItem[i+1].iCharPos - analysis->pItem[i].iCharPos;
|
||||||
|
int offset;
|
||||||
|
/* initialize max extents for uninitialized runs */
|
||||||
|
if (analysis->glyphs[i].iMaxPosX == -1)
|
||||||
{
|
{
|
||||||
if (analysis->pItem[i].a.fRTL)
|
if (analysis->pItem[i].a.fRTL)
|
||||||
itemTrailing = !fTrailing;
|
ScriptCPtoX(0, FALSE, CP, analysis->glyphs[i].numGlyphs, analysis->glyphs[i].pwLogClust,
|
||||||
|
analysis->glyphs[i].psva, analysis->glyphs[i].piAdvance,
|
||||||
|
&analysis->pItem[i].a, &analysis->glyphs[i].iMaxPosX);
|
||||||
else
|
else
|
||||||
itemTrailing = fTrailing;
|
ScriptCPtoX(CP, TRUE, CP, analysis->glyphs[i].numGlyphs, analysis->glyphs[i].pwLogClust,
|
||||||
for(j=0; j<analysis->glyphs[i].numGlyphs; j++)
|
analysis->glyphs[i].psva, analysis->glyphs[i].piAdvance,
|
||||||
{
|
&analysis->pItem[i].a, &analysis->glyphs[i].iMaxPosX);
|
||||||
if(runningCp == icp && itemTrailing == FALSE)
|
}
|
||||||
|
|
||||||
|
if (icp >= CP)
|
||||||
{
|
{
|
||||||
|
runningX += analysis->glyphs[i].iMaxPosX;
|
||||||
|
icp -= CP;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ScriptCPtoX(icp, fTrailing, CP, analysis->glyphs[i].numGlyphs, analysis->glyphs[i].pwLogClust,
|
||||||
|
analysis->glyphs[i].psva, analysis->glyphs[i].piAdvance,
|
||||||
|
&analysis->pItem[i].a, &offset);
|
||||||
|
runningX += offset;
|
||||||
|
|
||||||
*pX = runningX;
|
*pX = runningX;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
runningX += analysis->glyphs[i].piAdvance[j];
|
|
||||||
if(runningCp == icp && itemTrailing == TRUE)
|
|
||||||
{
|
|
||||||
*pX = runningX;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
runningCp++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* icp out of range */
|
/* icp out of range */
|
||||||
analysis->invalid = TRUE;
|
analysis->invalid = TRUE;
|
||||||
|
|
Loading…
Reference in New Issue