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>
This commit is contained in:
Caolán McNamara
2022-01-16 17:24:08 +00:00
parent 276258618b
commit 99460be87a
3 changed files with 23 additions and 4 deletions

View File

@@ -82,6 +82,11 @@ public:
int GetUnitsPerPixel() const { return mnUnitsPerPixel; }
Degree10 GetOrientation() const { return mnOrientation; }
void SetTextRenderModeForResolutionIndependentLayout(bool bTextRenderModeForResolutionIndependentLayout)
{
mbTextRenderModeForResolutionIndependentLayout = bTextRenderModeForResolutionIndependentLayout;
}
// methods using string indexing
virtual sal_Int32 GetTextBreak(DeviceCoordinate nMaxWidth, DeviceCoordinate nCharExtra, int nFactor) const = 0;
virtual DeviceCoordinate FillDXArray( std::vector<DeviceCoordinate>* pDXArray ) const = 0;
@@ -115,6 +120,8 @@ protected:
mutable Point maDrawOffset;
DevicePoint maDrawBase;
bool mbTextRenderModeForResolutionIndependentLayout;
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -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;

View File

@@ -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)