Revert "tdf#127471 Remove font width scaling hack"
This reverts commit 8891a2fc2a.
Reason for revert: Causes regressions like tdf#136891
Change-Id: I940c447bec38231b666eeac4212f09e22117504e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104847
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
This commit is contained in:
@@ -427,6 +427,20 @@ namespace drawinglayer::primitive2d
|
||||
aRetval.SetPitch(rFontAttribute.getMonospaced() ? PITCH_FIXED : PITCH_VARIABLE);
|
||||
aRetval.SetLanguage(LanguageTag::convertToLanguageType( rLocale, false));
|
||||
|
||||
#ifdef _WIN32
|
||||
// for WIN32 systems, correct the FontWidth if FontScaling is used
|
||||
if(bFontIsScaled && nHeight > 0)
|
||||
{
|
||||
const FontMetric aUnscaledFontMetric(Application::GetDefaultDevice()->GetFontMetric(aRetval));
|
||||
|
||||
if(aUnscaledFontMetric.GetAverageFontWidth() > 0)
|
||||
{
|
||||
const double fScaleFactor(static_cast<double>(nWidth) / static_cast<double>(nHeight));
|
||||
const sal_uInt32 nScaledWidth(basegfx::fround(static_cast<double>(aUnscaledFontMetric.GetAverageFontWidth()) * fScaleFactor));
|
||||
aRetval.SetAverageFontWidth(nScaledWidth);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// handle FontRotation (if defined)
|
||||
if(!basegfx::fTools::equalZero(fFontRotation))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user