vcl: flatten OutputDevice::AttemptOLEFontScaleFix()

Change-Id: Iac7dfec9622e60f0dc2ac0082ee8935077e3b5ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189697
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Christopher Sherlock
2025-08-18 07:58:04 +02:00
committed by Michael Weghorn
parent 5b064206d8
commit 2a3039e3d0
+14 -11
View File
@@ -815,17 +815,20 @@ bool OutputDevice::AttemptOLEFontScaleFix(vcl::Font& rFont, tools::Long nHeight)
const float fStretch = fNumerator / fDenominator;
const int nOrigWidth = mpFontInstance->mxFontMetric->GetWidth();
const int nNewWidth = static_cast<int>(nOrigWidth * fStretch + 0.5);
bool bRet = true;
if (nNewWidth != nOrigWidth && nNewWidth != 0)
{
Size aOrigSize = rFont.GetFontSize();
rFont.SetFontSize(Size(nNewWidth, nHeight));
mbMap = false;
mbNewFont = true;
bRet = ImplNewFont(); // recurse once using stretched width
mbMap = true;
rFont.SetFontSize(aOrigSize);
}
if (nNewWidth == nOrigWidth || nNewWidth == 0)
return true;
Size aOrigSize = rFont.GetFontSize();
rFont.SetFontSize(Size(nNewWidth, nHeight));
mbMap = false;
mbNewFont = true;
const bool bRet = ImplNewFont(); // recurse once using stretched width
mbMap = true;
rFont.SetFontSize(aOrigSize);
return bRet;
}