summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2018-02-22 13:52:13 +0200
committerTor Lillqvist <tml@collabora.com>2018-02-22 19:31:58 +0100
commit1d7f96a324a4c2ab82a04513c6a38dc31fd061fa (patch)
treea5d86a0641d328aad0ead54717c9a06e39cdd4ec
parent8bd289c43c34ab9258f4b08a0f3f6143dc710e4e (diff)
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@libreoffice.org> Reviewed-by: Tor Lillqvist <tml@collabora.com>
-rw-r--r--vcl/quartz/ctfonts.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index dbe4eb2cb96e..297c4dd58941 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.
*
@@ -382,6 +382,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));