tdf#103765: Minimize the effect of rounding to int
Instead of scaling the relative coordinates and accumulating rounding errors, scale the absolute coordinates. Also round to int instead of truncating. Change-Id: Ida0b4092685e898b7c5b5c07e923e386ffde8bcd
This commit is contained in:
parent
d34572d39d
commit
c49d5dea16
@ -553,19 +553,22 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
|
||||
if (aSubRun.maDirection == HB_DIRECTION_TTB)
|
||||
{
|
||||
nGlyphIndex |= GF_ROTL;
|
||||
nAdvance = -pHbPositions[i].y_advance * nYScale;
|
||||
nXOffset = pHbPositions[i].y_offset * nYScale;
|
||||
nYOffset = -pHbPositions[i].x_offset * nXScale;
|
||||
nAdvance = -pHbPositions[i].y_advance;
|
||||
nXOffset = pHbPositions[i].y_offset;
|
||||
nYOffset = pHbPositions[i].x_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
nAdvance = pHbPositions[i].x_advance * nXScale;
|
||||
nXOffset = pHbPositions[i].x_offset * nXScale;
|
||||
nYOffset = pHbPositions[i].y_offset * nYScale;
|
||||
nAdvance = pHbPositions[i].x_advance;
|
||||
nXOffset = pHbPositions[i].x_offset;
|
||||
nYOffset = -pHbPositions[i].y_offset;
|
||||
}
|
||||
|
||||
Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
|
||||
const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nAdvance, nXOffset);
|
||||
Point aNewPos(lround((aCurrPos.X() + nXOffset) * nXScale),
|
||||
lround((aCurrPos.Y() + nYOffset) * nYScale));
|
||||
const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags,
|
||||
lround(nAdvance * nXScale),
|
||||
lround(nXOffset * nXScale));
|
||||
AppendGlyph(aGI);
|
||||
|
||||
aCurrPos.X() += nAdvance;
|
||||
|
Loading…
x
Reference in New Issue
Block a user