diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-01-16 17:24:08 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-01-16 20:22:22 +0100 |
commit | 99460be87a11a404ce6c055fc540ec7ece404fb6 (patch) | |
tree | 8ee79e3e7d5ccaf0807769c5e3b0f3e1c3500234 /vcl | |
parent | 276258618b9ab548927a6c5df0cadba11994b70b (diff) |
Related: tdf#146453 retain accurate positioning in rotated text rendering
Change-Id: I477c5a72dd9618a2b0f3e91a96209ae3f6b3d1aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128484
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/sallayout.cxx | 18 | ||||
-rw-r--r-- | vcl/source/outdev/text.cxx | 2 |
2 files changed, 16 insertions, 4 deletions
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx index 64b1d22480e5..be020c2f11ae 100644 --- a/vcl/source/gdi/sallayout.cxx +++ b/vcl/source/gdi/sallayout.cxx @@ -135,7 +135,8 @@ SalLayout::SalLayout() mnEndCharPos( -1 ), mnUnitsPerPixel( 1 ), mnOrientation( 0 ), - maDrawOffset( 0, 0 ) + maDrawOffset( 0, 0 ), + mbTextRenderModeForResolutionIndependentLayout(false) {} SalLayout::~SalLayout() @@ -171,9 +172,18 @@ DevicePoint SalLayout::GetDrawPosition(const DevicePoint& rRelative) const double fX = aOfs.getX(); double fY = aOfs.getY(); - tools::Long nX = static_cast<tools::Long>( +fCos * fX + fSin * fY ); - tools::Long nY = static_cast<tools::Long>( +fCos * fY - fSin * fX ); - aPos += DevicePoint(nX, nY); + if (mbTextRenderModeForResolutionIndependentLayout) + { + double nX = +fCos * fX + fSin * fY; + double nY = +fCos * fY - fSin * fX; + aPos += DevicePoint(nX, nY); + } + else + { + tools::Long nX = static_cast<tools::Long>( +fCos * fX + fSin * fY ); + tools::Long nY = static_cast<tools::Long>( +fCos * fY - fSin * fX ); + aPos += DevicePoint(nX, nY); + } } return aPos; diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index f9f0fd54b673..49ca790b8aec 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -1411,6 +1411,8 @@ std::unique_ptr<SalLayout> OutputDevice::ImplLayout(const OUString& rOrigStr, if( !pSalLayout ) return nullptr; + pSalLayout->SetTextRenderModeForResolutionIndependentLayout(bTextRenderModeForResolutionIndependentLayout); + // do glyph fallback if needed // #105768# avoid fallback for very small font sizes if (aLayoutArgs.HasFallbackRun() && mpFontInstance->GetFontSelectPattern().mnHeight >= 3) |