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);
|
||||||
|
|
||||||
|
@ -951,25 +951,35 @@ 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++)
|
||||||
{
|
{
|
||||||
if (analysis->pItem[i].a.fRTL)
|
int CP = analysis->pItem[i+1].iCharPos - analysis->pItem[i].iCharPos;
|
||||||
itemTrailing = !fTrailing;
|
int offset;
|
||||||
else
|
/* initialize max extents for uninitialized runs */
|
||||||
itemTrailing = fTrailing;
|
if (analysis->glyphs[i].iMaxPosX == -1)
|
||||||
for(j=0; j<analysis->glyphs[i].numGlyphs; j++)
|
|
||||||
{
|
{
|
||||||
if(runningCp == icp && itemTrailing == FALSE)
|
if (analysis->pItem[i].a.fRTL)
|
||||||
{
|
ScriptCPtoX(0, FALSE, CP, analysis->glyphs[i].numGlyphs, analysis->glyphs[i].pwLogClust,
|
||||||
*pX = runningX;
|
analysis->glyphs[i].psva, analysis->glyphs[i].piAdvance,
|
||||||
return S_OK;
|
&analysis->pItem[i].a, &analysis->glyphs[i].iMaxPosX);
|
||||||
}
|
else
|
||||||
runningX += analysis->glyphs[i].piAdvance[j];
|
ScriptCPtoX(CP, TRUE, CP, analysis->glyphs[i].numGlyphs, analysis->glyphs[i].pwLogClust,
|
||||||
if(runningCp == icp && itemTrailing == TRUE)
|
analysis->glyphs[i].psva, analysis->glyphs[i].piAdvance,
|
||||||
{
|
&analysis->pItem[i].a, &analysis->glyphs[i].iMaxPosX);
|
||||||
*pX = runningX;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
runningCp++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* icp out of range */
|
/* icp out of range */
|
||||||
|
|
Loading…
Reference in New Issue