vcl/source/font/LogicalFontInstance.cxx |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit 291c90811ada39ed079d458887a59fc8977494f6
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Mar 29 08:55:24 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Mar 29 06:11:11 2024 +0100

    Simplify a bit
    
    Change-Id: I2a5b870516d8b597ebf476c7c1da7549a27571ac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165503
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/vcl/source/font/LogicalFontInstance.cxx 
b/vcl/source/font/LogicalFontInstance.cxx
index 0c21cba47548..94e1e72353fb 100644
--- a/vcl/source/font/LogicalFontInstance.cxx
+++ b/vcl/source/font/LogicalFontInstance.cxx
@@ -113,19 +113,20 @@ double LogicalFontInstance::GetKashidaWidth() const
 void LogicalFontInstance::GetScale(double* nXScale, double* nYScale) const
 {
     double nUPEM = GetFontFace()->UnitsPerEm();
-    double nHeight(m_aFontSelData.mnHeight);
-
-    // On Windows, mnWidth is relative to average char width not font height,
-    // and we need to keep it that way for GDI to correctly scale the glyphs.
-    // Here we compensate for this so that HarfBuzz gives us the correct glyph
-    // positions.
-    double nWidth(m_aFontSelData.mnWidth ? m_aFontSelData.mnWidth * 
m_nAveWidthFactor : nHeight);
 
     if (nYScale)
-        *nYScale = nHeight / nUPEM;
+        *nYScale = m_aFontSelData.mnHeight / nUPEM;
 
     if (nXScale)
+    {
+        // On Windows, mnWidth is relative to average char width not font 
height,
+        // and we need to keep it that way for GDI to correctly scale the 
glyphs.
+        // Here we compensate for this so that HarfBuzz gives us the correct 
glyph
+        // positions.
+        double nWidth(m_aFontSelData.mnWidth ? m_aFontSelData.mnWidth * 
GetAverageWidthFactor()
+                                             : m_aFontSelData.mnHeight);
         *nXScale = nWidth / nUPEM;
+    }
 }
 
 void LogicalFontInstance::AddFallbackForUnicode(sal_UCS4 cChar, FontWeight 
eWeight,

Reply via email to