diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-16 17:27:26 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-16 20:22:45 +0100 |
commit | 95ade11df658d73e90d196f041d0839895aca3f0 (patch) | |
tree | d54f0c68a57efd60af6bbd2a0ef2aad5684ca084 /vcl/source/outdev | |
parent | 99460be87a11a404ce6c055fc540ec7ece404fb6 (diff) |
tdf#146453 retain precise vertical base pos with ResolutionIndependentLayout
Change-Id: Ied157d8d4bc9b57cfa17716453189ddf48cba641
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128485
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/outdev')
-rw-r--r-- | vcl/source/outdev/map.cxx | 17 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 11 |
2 files changed, 16 insertions, 12 deletions
diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 5144f0f89f9f..918d8a5a77df 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -1830,7 +1830,7 @@ DeviceCoordinate OutputDevice::LogicWidthToDeviceCoordinate( tools::Long nWidth #endif } -double OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const +double OutputDevice::ImplLogicWidthToDeviceFontWidth(tools::Long nWidth) const { if (!mbMap) return nWidth; @@ -1839,14 +1839,17 @@ double OutputDevice::LogicWidthToDeviceFontCoordinate(tools::Long nWidth) const maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX); } -double OutputDevice::LogicXToDeviceFontCoordinate(tools::Long nX) const +DevicePoint OutputDevice::ImplLogicToDeviceFontCoordinate(const Point& rPoint) const { if (!mbMap) - return nX + mnOutOffX; - - return ImplLogicToPixel(static_cast<double>(nX + maMapRes.mnMapOfsX), mnDPIX, - maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX) - + mnOutOffX + mnOutOffOrigX; + return DevicePoint(rPoint.X() + mnOutOffX, rPoint.Y() + mnOutOffY); + + return DevicePoint(ImplLogicToPixel(static_cast<double>(rPoint.X() + maMapRes.mnMapOfsX), mnDPIX, + maMapRes.mnMapScNumX, maMapRes.mnMapScDenomX) + + mnOutOffX + mnOutOffOrigX, + ImplLogicToPixel(static_cast<double>(rPoint.Y() + maMapRes.mnMapOfsY), mnDPIY, + maMapRes.mnMapScNumY, maMapRes.mnMapScDenomY) + + mnOutOffY + mnOutOffOrigY); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 49ca790b8aec..3d773e56d488 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1359,7 +1359,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, xNaturalDXPixelArray.reset(new double[nLen]); for (int i = 0; i < nLen; ++i) - xNaturalDXPixelArray[i] = LogicWidthToDeviceFontCoordinate(pDXArray[i]); + xNaturalDXPixelArray[i] = ImplLogicWidthToDeviceFontWidth(pDXArray[i]); aLayoutArgs.SetAltNaturalDXArray(xNaturalDXPixelArray.get()); nEndGlyphCoord = std::lround(xNaturalDXPixelArray[nLen - 1]); @@ -1426,12 +1426,13 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, // position, justify, etc. the layout pSalLayout->AdjustLayout( aLayoutArgs ); - Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos); if (bTextRenderModeForResolutionIndependentLayout) - pSalLayout->DrawBase().setX(LogicXToDeviceFontCoordinate(rLogicalPos.X())); + pSalLayout->DrawBase() = ImplLogicToDeviceFontCoordinate(rLogicalPos); else - pSalLayout->DrawBase().setX(aDevicePos.X()); - pSalLayout->DrawBase().setY(aDevicePos.Y()); + { + Point aDevicePos = ImplLogicToDevicePixel(rLogicalPos); + pSalLayout->DrawBase() = DevicePoint(aDevicePos.X(), aDevicePos.Y()); + } // adjust to right alignment if necessary if( aLayoutArgs.mnFlags & SalLayoutFlags::RightAlign ) |