summaryrefslogtreecommitdiff
path: root/emfio/source/reader/mtftools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'emfio/source/reader/mtftools.cxx')
-rw-r--r--emfio/source/reader/mtftools.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 4de2dd4c1fe2..3053d3878e13 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -296,8 +296,26 @@ namespace emfio
// Convert height to positive
aFontSize.setHeight( std::abs(aFontSize.Height()) );
-
aFont.SetFontSize(aFontSize);
+
+ // tdf#127471 adapt nFontWidth from Windows-like notation to
+ // NormedFontScaling if used for text scaling
+#ifndef _WIN32
+ const bool bFontScaledHorizontally(aFontSize.Width() != 0 && aFontSize.Width() != aFontSize.Height());
+
+ if(bFontScaledHorizontally)
+ {
+ // tdf#127471 nFontWidth is the Windows FontScaling, need to convert to
+ // Non-Windowslike notation relative to FontHeight.
+ const long nAverageFontWidth(aFont.GetOrCalculateAverageFontWidth());
+
+ if(nAverageFontWidth > 0)
+ {
+ const double fScaleFactor(static_cast<double>(aFontSize.Height()) / static_cast<double>(nAverageFontWidth));
+ aFont.SetAverageFontWidth(static_cast<long>(static_cast<double>(aFontSize.Width()) * fScaleFactor));
+ }
+ }
+#endif
};
Color MtfTools::ReadColor()