[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3-desktop' - vcl/quartz

Tor Lillqvist tml at collabora.com
Wed Feb 28 10:09:03 UTC 2018


 vcl/quartz/ctfonts.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit a5e291b1754f3183f9369a0fae102c352bd578a0
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Feb 22 13:52:13 2018 +0200

    tdf#67744: Fix the weight reported by the system for the problematic font
    
    A hack, but oh well.
    
    Change-Id: I13580d27acfb0cc200bdb0cc1911518675d3e32e
    Reviewed-on: https://gerrit.libreoffice.org/50172
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>
    (cherry picked from commit 1d7f96a324a4c2ab82a04513c6a38dc31fd061fa)
    Reviewed-on: https://gerrit.libreoffice.org/50496
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 0a018fd460f1..4420e99378b1 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -1,4 +1,4 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
 /*
  * This file is part of the LibreOffice project.
  *
@@ -410,6 +410,18 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
     CFNumberRef pWeightNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWeightTrait ));
     CFNumberGetValue( pWeightNum, kCFNumberDoubleType, &fWeight );
     int nInt = WEIGHT_NORMAL;
+
+    // Special case fixes
+
+    // tdf#67744: Courier Std Medium is always bold. We get a kCTFontWeightTrait of 0.23 which
+    // surely must be wrong.
+    if (rDFA.GetFamilyName() == "Courier Std" &&
+        (rDFA.GetStyleName() == "Medium" || rDFA.GetStyleName() == "Medium Oblique") &&
+        fWeight > 0.2)
+    {
+        fWeight = 0;
+    }
+
     if( fWeight > 0 )
     {
         nInt = rint(WEIGHT_NORMAL + fWeight * ((WEIGHT_BLACK - WEIGHT_NORMAL)/0.68));


More information about the Libreoffice-commits mailing list