diff options
author | Armin Le Grand (Allotropia) <armin.le.grand@me.com> | 2021-02-16 18:20:32 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2021-02-17 09:31:09 +0100 |
commit | 9d161857f1d4afcb772b477455797a2da0e47a9b (patch) | |
tree | 261c8146ffd4eb9a2b8d15ce6b7648a48ba2faa7 /include | |
parent | 10e16862684c71361119565ee4dc6bdf3e217197 (diff) |
tdf#127471 correct EMF/WMF im/export for scaled font
If FontScaling is used, system-dependent data is held at
vcl::Font Width(). Already if not scaled, we have three
definitions: Width is zero, Width is equal to Height (unx)
or - on Windows - Width equals avgFontWidth.
If used it is W!=H where on unx Width equals Height multiplied
with the scale factor. On Windows, this is Width multiplied
with the only there existing avgFontWidth.
Unfortunately that is ex/imported (since ever) undetected
to EMF/WMF thus making EMF/WMF files containing FontScaling
system-dependent - on which system was LO running when
creating the file? The error can be seen when loading such
a EMF/WMF on the vice-versa system, the FontScale is very
ugly and wrong.
Since EMF/WMF *are* Windows-specific formats the Windows-like
definition is the correct one. This change makes all other
systems export that now, and adapt on import to their system-
specific definition (assuming coming from Windows).
As can be seen, the difficulty is that these adaptions are
necessary on non-Windows plattforms, but these do not have
that avgFontWidth available. Thus I made a deep-dive
investigation and multiple experiments to create a as
similar as possible value to apply the needed calculations.
For details and discussion refer to the bug description.
Change-Id: I983fb6d882e2e8fccf9c8460f01509201d8157f9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111000
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/font.hxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx index 2d437c5b3da0..3147f57aba14 100644 --- a/include/vcl/font.hxx +++ b/include/vcl/font.hxx @@ -113,6 +113,9 @@ public: void SetAverageFontWidth( tools::Long nWidth ); tools::Long GetAverageFontWidth() const; + // tdf#127471 for corrections on EMF/WMF we need the AvgFontWidth in Windows-specific notation + tools::Long GetOrCalculateAverageFontWidth() const; + // Prefer LanguageTag over LanguageType void SetLanguageTag( const LanguageTag & ); const LanguageTag& GetLanguageTag() const; |