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:
committed by
Michael Weghorn
parent
5b064206d8
commit
2a3039e3d0
+14
-11
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user