diff options
author | Liang Qi <liang.qi@qt.io> | 2016-05-19 11:04:19 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-05-19 12:55:27 +0200 |
commit | 818014b449ef996099b4795a82f09651cf1c0129 (patch) | |
tree | 02f991007097fa368491a81eebbabe4cc162a0e0 /src/platformsupport/fontdatabases | |
parent | e6cc1d788dddda2998a9f941664ede928ce1e212 (diff) | |
parent | 640441882d20f86db05ab5fd1141abe39a0bd409 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
configure
src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
src/network/access/qnetworkaccessmanager.cpp
src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h
src/widgets/widgets/qlineedit_p.cpp
src/widgets/widgets/qlineedit_p.h
src/winmain/winmain.pro
tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp
tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp
tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h
tests/auto/testlib/selftests/expected_cmptest.teamcity
tests/auto/testlib/selftests/expected_cmptest.txt
tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp
tools/configure/configureapp.cpp
Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 2 | ||||
-rw-r--r-- | src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | 65 |
2 files changed, 55 insertions, 12 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index f5372151b7..533e0e2d5b 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -373,7 +373,7 @@ static QByteArray filenameForCFUrl(CFURLRef url) if (!CFURLGetFileSystemRepresentation(url, true, buffer, sizeof(buffer))) { qWarning("QCoreTextFontDatabase::filenameForCFUrl: could not resolve file for URL %s", - qPrintable(QString::fromCFString(CFURLGetString(url)))); + url ? qPrintable(QString::fromCFString(CFURLGetString(url))) : "(null)"); } else { QCFType<CFStringRef> scheme = CFURLCopyScheme(url); if (QString::fromCFString(scheme) == QLatin1String("qrc")) diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index c7209fe696..3d214b6f39 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -47,6 +47,49 @@ #include <cmath> +#if defined(Q_OS_OSX) && !QT_OSX_DEPLOYMENT_TARGET_BELOW(__MAC_10_11) +#import <AppKit/AppKit.h> +#endif + +#if defined(Q_OS_IOS) && !QT_IOS_DEPLOYMENT_TARGET_BELOW(__IPHONE_8_2) +#import <UIKit/UIKit.h> +#endif + +// These are available cross platform, exported as kCTFontWeightXXX from CoreText.framework, +// but they are not documented and are not in public headers so are private API and exposed +// only through the NSFontWeightXXX and UIFontWeightXXX aliases in AppKit and UIKit (rdar://26109857) +#if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_11, __IPHONE_8_2) +#define kCTFontWeightUltraLight -0.8 +#define kCTFontWeightThin -0.6 +#define kCTFontWeightLight -0.4 +#define kCTFontWeightRegular 0 +#define kCTFontWeightMedium 0.23 +#define kCTFontWeightSemibold 0.3 +#define kCTFontWeightBold 0.4 +#define kCTFontWeightHeavy 0.56 +#define kCTFontWeightBlack 0.62 +#elif defined(Q_OS_OSX) +#define kCTFontWeightUltraLight NSFontWeightUltraLight +#define kCTFontWeightThin NSFontWeightThin +#define kCTFontWeightLight NSFontWeightLight +#define kCTFontWeightRegular NSFontWeightRegular +#define kCTFontWeightMedium NSFontWeightMedium +#define kCTFontWeightSemibold NSFontWeightSemibold +#define kCTFontWeightBold NSFontWeightBold +#define kCTFontWeightHeavy NSFontWeightHeavy +#define kCTFontWeightBlack NSFontWeightBlack +#elif defined(Q_OS_IOS) +#define kCTFontWeightUltraLight UIFontWeightUltraLight +#define kCTFontWeightThin UIFontWeightThin +#define kCTFontWeightLight UIFontWeightLight +#define kCTFontWeightRegular UIFontWeightRegular +#define kCTFontWeightMedium UIFontWeightMedium +#define kCTFontWeightSemibold UIFontWeightSemibold +#define kCTFontWeightBold UIFontWeightBold +#define kCTFontWeightHeavy UIFontWeightHeavy +#define kCTFontWeightBlack UIFontWeightBlack +#endif + QT_BEGIN_NAMESPACE static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f); @@ -69,24 +112,24 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value) { - if (value >= 0.62) + if (value >= kCTFontWeightBlack) return QFont::Black; - if (value >= 0.5) + if (value >= kCTFontWeightHeavy) return QFont::ExtraBold; - if (value >= 0.4) + if (value >= kCTFontWeightBold) return QFont::Bold; - if (value >= 0.3) + if (value >= kCTFontWeightSemibold) return QFont::DemiBold; - if (value >= 0.2) + if (value >= kCTFontWeightMedium) return QFont::Medium; - if (value == 0.0) + if (value == kCTFontWeightRegular) return QFont::Normal; - if (value <= -0.4) - return QFont::Light; - if (value <= -0.6) - return QFont::ExtraLight; - if (value <= -0.8) + if (value <= kCTFontWeightUltraLight) return QFont::Thin; + if (value <= kCTFontWeightThin) + return QFont::ExtraLight; + if (value <= kCTFontWeightLight) + return QFont::Light; return QFont::Normal; } |