Skip to content
This repository has been archived by the owner on Aug 25, 2020. It is now read-only.

Commit

Permalink
Backport Qt patch for fixing font weights on macOS mojave
Browse files Browse the repository at this point in the history
  • Loading branch information
kovidgoyal committed Oct 18, 2018
1 parent 18a97e9 commit 3a421d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions patches/fix_mojave_font_weights_in_qt_5.6.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
--- ./qtbase/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm.orig 2018-10-18 10:36:55.016457121 +0530
+++ ./qtbase/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm 2018-10-18 10:37:26.469615885 +0530
@@ -300,9 +300,9 @@ static void getFontDescription(CTFontDes

if (styles) {
if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) {
- float normalizedWeight;
- if (CFNumberGetValue(weightValue, kCFNumberFloatType, &normalizedWeight))
- fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(normalizedWeight);
+ double normalizedWeight;
+ if (CFNumberGetValue(weightValue, kCFNumberFloat64Type, &normalizedWeight))
+ fd->weight = QCoreTextFontEngine::qtWeightFromCFWeight(float(normalizedWeight));
}
if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) {
double d;
3 changes: 2 additions & 1 deletion scripts/pkgs/qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import shutil

from .constants import CFLAGS, LDFLAGS, MAKEOPTS, build_dir, isosx, islinux, LIBDIR, iswindows, PREFIX
from .utils import run, run_shell, replace_in_file, ModifiedEnv, current_env
from .utils import apply_patch, run, run_shell, replace_in_file, ModifiedEnv, current_env


def main(args):
Expand All @@ -29,6 +29,7 @@ def main(args):
r'''searchOrder << (QFileInfo(qAppFileName()).path().replace(QLatin1Char('/'), QLatin1Char('\\')) + QString::fromLatin1("\\app\\DLLs\\"));''')
cflags, ldflags = CFLAGS, LDFLAGS
if isosx:
apply_patch('fix_mojave_font_weights_in_qt_5.6.patch')
ldflags = '-L' + LIBDIR
# The following is needed as without it the Qt build system does not add the
# necessary -stdlib=libc++ when linking. Probably, you can get rid of
Expand Down

0 comments on commit 3a421d8

Please sign in to comment.