summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2019-06-16 02:38:02 +0200
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2019-06-17 01:19:36 +0200
commitcd33eb812277f516f4670edfffd68e5b763e8a4c (patch)
treeff3b3e44c6fe5128242c24f82b1641e9a9885a97 /vcl
parented9cb51dfddf066b0b19681e86c42121aa9cce9c (diff)
tdf#121486: Correct scale of broken fonts on Windows
Some fonts have negative tmAveCharWidth which makes no sense (fonts can't have negative glyph width, so the average can't be negative) and it would cause our code to apply negative scale to the glyphs of these fonts making them drawn on the flipped horizontally. Fix this by using the absolute value so it is always positive. Change-Id: I731e7aad80dae734847679a1b08c6ac78111e16c Reviewed-on: https://gerrit.libreoffice.org/74109 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> (cherry picked from commit 8fffb56940c6eb81674000cdb718edc79603a6c5) Reviewed-on: https://gerrit.libreoffice.org/74123 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/fontinstance.hxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index 58bcd07927a0..f8199669952f 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -63,7 +63,7 @@ public: // TODO: make data members private
void IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, const OUString& rFontName );
inline hb_font_t* GetHbFont();
- void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+ void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = std::abs(nFactor); }
double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; }