From d35b5c8db00afb0316b7ae4c43126a5dad194cbb Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Sat, 19 Nov 2016 15:07:03 +0200 Subject: tdf#103891: Fix DX array calculation This partially reverts: commit c49d5dea164b09b05a898495fa2dd48b7ca4f0e4 Author: Khaled Hosny Date: Fri Nov 11 18:24:11 2016 +0200 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. as it results in OutputDevice::GetTextArray() calculating wrong absolute DX array. Again the whole DX array thing is brain dead. Change-Id: Ia257b73062315b797b5ed52e434562fad3b3fb90 --- vcl/source/gdi/CommonSalLayout.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vcl') diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 9ad19679056a..b9240e74f87c 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -595,11 +595,13 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) nYOffset = -pHbPositions[i].y_offset; } - Point aNewPos(lround((aCurrPos.X() + nXOffset) * nXScale), - lround((aCurrPos.Y() + nYOffset) * nYScale)); + nAdvance *= nXScale; + nXOffset *= nXScale; + nYOffset *= nYScale; + + Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + nYOffset); const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, - lround(nAdvance * nXScale), - lround(nXOffset * nXScale)); + nAdvance, nXOffset); AppendGlyph(aGI); aCurrPos.X() += nAdvance; -- cgit