vcl/source/outdev/font.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit 2a3039e3d0617c5253061890a0e102561dbbed68 Author: Christopher Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sat Aug 16 01:36:37 2025 +1000 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Aug 18 07:58:04 2025 +0200 vcl: flatten OutputDevice::AttemptOLEFontScaleFix() Change-Id: Iac7dfec9622e60f0dc2ac0082ee8935077e3b5ef Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189697 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 9d1942a8a2f9..3f350502426e 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -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; }