summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r--src/platformsupport/fontdatabases/basic/basic.pri2
-rw-r--r--src/platformsupport/fontdatabases/mac/coretext.pri5
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm259
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h9
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm19
-rw-r--r--src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h9
6 files changed, 110 insertions, 193 deletions
diff --git a/src/platformsupport/fontdatabases/basic/basic.pri b/src/platformsupport/fontdatabases/basic/basic.pri
index d70b3b6a1a..52cf771b2a 100644
--- a/src/platformsupport/fontdatabases/basic/basic.pri
+++ b/src/platformsupport/fontdatabases/basic/basic.pri
@@ -8,6 +8,4 @@ SOURCES += \
$$PWD/qbasicfontdatabase.cpp \
$$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
-CONFIG += opentype
-
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri
index ebb64d15b4..272e7591ba 100644
--- a/src/platformsupport/fontdatabases/mac/coretext.pri
+++ b/src/platformsupport/fontdatabases/mac/coretext.pri
@@ -5,11 +5,10 @@ contains(QT_CONFIG, freetype) {
include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri)
HEADERS += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft_p.h
SOURCES += $$QT_SOURCE_TREE/src/gui/text/qfontengine_ft.cpp
- CONFIG += opentype
}
-ios: \
- # On iOS CoreText and CoreGraphics are stand-alone frameworks
+uikit: \
+ # On iOS/tvOS CoreText and CoreGraphics are stand-alone frameworks
LIBS_PRIVATE += -framework CoreText -framework CoreGraphics
else: \
# On Mac OS they are part of the ApplicationServices umbrella framework,
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 533e0e2d5b..d81a68d6e5 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -44,7 +44,7 @@
#if defined(Q_OS_OSX)
#import <AppKit/AppKit.h>
#import <IOKit/graphics/IOGraphicsLib.h>
-#elif defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
#import <UIKit/UIFont.h>
#endif
@@ -191,7 +191,7 @@ static CFArrayRef availableFamilyNames()
{
#if defined(Q_OS_OSX)
return CTFontManagerCopyAvailableFontFamilyNames();
-#elif defined(Q_OS_IOS)
+#elif defined(QT_PLATFORM_UIKIT)
return (CFArrayRef) [[UIFont familyNames] retain];
#endif
}
@@ -517,46 +517,37 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
static QHash<QString, QStringList> fallbackLists;
if (!family.isEmpty()) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_6_0)
- // CTFontCopyDefaultCascadeListForLanguages is available in the SDK
- #if QT_MAC_DEPLOYMENT_TARGET_BELOW(__MAC_10_8, __IPHONE_6_0)
- // But we have to feature check at runtime
- if (&CTFontCopyDefaultCascadeListForLanguages)
- #endif
- {
- QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
- if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
- if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
- NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
- NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
-
- QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
- if (cascadeList) {
- QStringList fallbackList;
- const int numCascades = CFArrayGetCount(cascadeList);
- for (int i = 0; i < numCascades; ++i) {
- CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
- QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
- fallbackList.append(QCFString::toQString(fallbackFamilyName));
- }
+ QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionaryAddValue(attributes, kCTFontFamilyNameAttribute, QCFString(family));
+ if (QCFType<CTFontDescriptorRef> fontDescriptor = CTFontDescriptorCreateWithAttributes(attributes)) {
+ if (QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(fontDescriptor, 12.0, 0)) {
+ NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+ NSArray *languages = [defaults stringArrayForKey: @"AppleLanguages"];
+
+ QCFType<CFArrayRef> cascadeList = (CFArrayRef) CTFontCopyDefaultCascadeListForLanguages(font, (CFArrayRef) languages);
+ if (cascadeList) {
+ QStringList fallbackList;
+ const int numCascades = CFArrayGetCount(cascadeList);
+ for (int i = 0; i < numCascades; ++i) {
+ CTFontDescriptorRef fontFallback = (CTFontDescriptorRef) CFArrayGetValueAtIndex(cascadeList, i);
+ QCFString fallbackFamilyName = (CFStringRef) CTFontDescriptorCopyAttribute(fontFallback, kCTFontFamilyNameAttribute);
+ fallbackList.append(QCFString::toQString(fallbackFamilyName));
+ }
#if defined(Q_OS_OSX)
- // Since we are only returning a list of default fonts for the current language, we do not
- // cover all unicode completely. This was especially an issue for some of the common script
- // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
- // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
- // of Unicode 2.1.
- if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
- fallbackList.append(QStringLiteral("Arial Unicode MS"));
+ // Since we are only returning a list of default fonts for the current language, we do not
+ // cover all unicode completely. This was especially an issue for some of the common script
+ // symbols such as mathematical symbols, currency or geometric shapes. To minimize the risk
+ // of missing glyphs, we add Arial Unicode MS as a final fail safe, since this covers most
+ // of Unicode 2.1.
+ if (!fallbackList.contains(QStringLiteral("Arial Unicode MS")))
+ fallbackList.append(QStringLiteral("Arial Unicode MS"));
#endif
- return fallbackList;
- }
+ return fallbackList;
}
}
}
-#endif
}
// We were not able to find a fallback for the specific family,
@@ -620,7 +611,6 @@ QStringList QCoreTextFontDatabase::fallbacksForFamily(const QString &family, QFo
return fallbackLists[styleLookupKey.arg(styleHint)];
}
-#if HAVE_CORETEXT
static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fileName = QString())
{
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
@@ -638,7 +628,7 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
// QUrl::fromLocalFile() doesn't accept qrc pseudo-paths like ":/fonts/myfont.ttf".
// Therefore construct from QString with the qrc:// scheme -> "qrc:///fonts/myfont.ttf".
fontURL = QUrl(QStringLiteral("qrc://") + fileName.mid(1)).toCFURL();
- } else if (!fileName.isEmpty()) {
+ } else {
// At this point we hope that filename is in a format that QUrl can handle.
fontURL = QUrl::fromLocalFile(fileName).toCFURL();
}
@@ -653,104 +643,41 @@ static CFArrayRef createDescriptorArrayForFont(CTFontRef font, const QString &fi
CFArrayAppendValue(array, descriptor);
return array;
}
-#endif
QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData, const QString &fileName)
{
QCFType<CFArrayRef> fonts;
QStringList families;
-#if HAVE_CORETEXT
- if (&CTFontManagerRegisterGraphicsFont) {
- CFErrorRef error = 0;
- if (!fontData.isEmpty()) {
- QByteArray* fontDataCopy = new QByteArray(fontData);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
- fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
- QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
- if (cgFont) {
- if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
- QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
- fonts = createDescriptorArrayForFont(font
+ CFErrorRef error = 0;
+ if (!fontData.isEmpty()) {
+ QByteArray* fontDataCopy = new QByteArray(fontData);
+ QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(fontDataCopy,
+ fontDataCopy->constData(), fontDataCopy->size(), releaseFontData);
+ QCFType<CGFontRef> cgFont = CGFontCreateWithDataProvider(dataProvider);
+ if (cgFont) {
+ if (CTFontManagerRegisterGraphicsFont(cgFont, &error)) {
+ QCFType<CTFontRef> font = CTFontCreateWithGraphicsFont(cgFont, 0.0, NULL, NULL);
+ fonts = createDescriptorArrayForFont(font
#ifndef QT_NO_FREETYPE
- , m_useFreeType ? fileName : QString()
-#endif
- );
- m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
- }
- }
- } else {
- QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
- if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
-#if QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_6, __IPHONE_7_0)
- if (&CTFontManagerCreateFontDescriptorsFromURL)
- fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
- else
+ , m_useFreeType ? fileName : QString()
#endif
- {
- // We're limited to a single font per file, unless we dive into the font tables
- QCFType<CFMutableDictionaryRef> attributes = CFDictionaryCreateMutable(kCFAllocatorDefault, 1,
- &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
- CFDictionaryAddValue(attributes, kCTFontURLAttribute, fontURL);
- QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithAttributes(attributes);
- QCFType<CTFontRef> font = CTFontCreateWithFontDescriptor(descriptor, 0.0, NULL);
- fonts = createDescriptorArrayForFont(font);
- }
-
- m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
+ );
+ m_applicationFonts.append(QVariant::fromValue(QCFType<CGFontRef>::constructFromGet(cgFont)));
}
}
-
- if (error) {
- NSLog(@"Unable to register font: %@", error);
- CFRelease(error);
+ } else {
+ QCFType<CFURLRef> fontURL = CFURLCreateWithFileSystemPath(NULL, QCFString(fileName), kCFURLPOSIXPathStyle, false);
+ if (CTFontManagerRegisterFontsForURL(fontURL, kCTFontManagerScopeProcess, &error)) {
+ fonts = CTFontManagerCreateFontDescriptorsFromURL(fontURL);
+ m_applicationFonts.append(QVariant::fromValue(QCFType<CFURLRef>::constructFromGet(fontURL)));
}
}
-#endif
-#if HAVE_CORETEXT && HAVE_ATS
- else
-#endif
-#if HAVE_ATS
- {
- ATSFontContainerRef fontContainer;
- OSStatus e;
-
- if (!fontData.isEmpty()) {
- e = ATSFontActivateFromMemory((void *) fontData.constData(), fontData.size(),
- kATSFontContextLocal, kATSFontFormatUnspecified, NULL,
- kATSOptionFlagsDefault, &fontContainer);
- } else {
- FSRef ref;
- if (FSPathMakeRef(reinterpret_cast<const UInt8 *>(fileName.toUtf8().constData()),
- &ref, 0) != noErr)
- return QStringList();
- e = ATSFontActivateFromFileReference(&ref, kATSFontContextLocal, kATSFontFormatUnspecified, 0,
- kATSOptionFlagsDefault, &fontContainer);
- }
-
- if (e == noErr) {
- ItemCount fontCount = 0;
- e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, 0, 0, &fontCount);
- if (e != noErr)
- return QStringList();
-
- QVarLengthArray<ATSFontRef> containedFonts(fontCount);
- e = ATSFontFindFromContainer(fontContainer, kATSOptionFlagsDefault, fontCount, containedFonts.data(), &fontCount);
- if (e != noErr)
- return QStringList();
-
- CFMutableArrayRef fontsArray = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
- for (int i = 0; i < containedFonts.size(); ++i) {
- QCFType<CTFontRef> font = CTFontCreateWithPlatformFont(containedFonts[i], 12.0, NULL, NULL);
- CFArrayAppendValue(fontsArray, QCFType<CTFontDescriptorRef>(CTFontCopyFontDescriptor(font)));
- }
- fonts = fontsArray;
-
- m_applicationFonts.append(QVariant::fromValue(fontContainer));
- }
+ if (error) {
+ NSLog(@"Unable to register font: %@", error);
+ CFRelease(error);
}
-#endif
if (fonts) {
const int numFonts = CFArrayGetCount(fonts);
@@ -847,41 +774,39 @@ static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f)
static CTFontDescriptorRef fontDescriptorFromTheme(QPlatformTheme::Font f)
{
-#ifdef Q_OS_IOS
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_IOS_7_0) {
- // Use Dynamic Type to resolve theme fonts if possible, to get
- // correct font sizes and style based on user configuration.
- NSString *textStyle = 0;
- switch (f) {
- case QPlatformTheme::TitleBarFont:
- case QPlatformTheme::HeaderViewFont:
- textStyle = UIFontTextStyleHeadline;
- break;
- case QPlatformTheme::MdiSubWindowTitleFont:
- textStyle = UIFontTextStyleSubheadline;
- break;
- case QPlatformTheme::TipLabelFont:
- case QPlatformTheme::SmallFont:
- textStyle = UIFontTextStyleFootnote;
- break;
- case QPlatformTheme::MiniFont:
- textStyle = UIFontTextStyleCaption2;
- break;
- case QPlatformTheme::FixedFont:
- // Fall back to regular code path, as iOS doesn't provide
- // an appropriate text style for this theme font.
- break;
- default:
- textStyle = UIFontTextStyleBody;
- break;
- }
+#if defined(QT_PLATFORM_UIKIT)
+ // Use Dynamic Type to resolve theme fonts if possible, to get
+ // correct font sizes and style based on user configuration.
+ NSString *textStyle = 0;
+ switch (f) {
+ case QPlatformTheme::TitleBarFont:
+ case QPlatformTheme::HeaderViewFont:
+ textStyle = UIFontTextStyleHeadline;
+ break;
+ case QPlatformTheme::MdiSubWindowTitleFont:
+ textStyle = UIFontTextStyleSubheadline;
+ break;
+ case QPlatformTheme::TipLabelFont:
+ case QPlatformTheme::SmallFont:
+ textStyle = UIFontTextStyleFootnote;
+ break;
+ case QPlatformTheme::MiniFont:
+ textStyle = UIFontTextStyleCaption2;
+ break;
+ case QPlatformTheme::FixedFont:
+ // Fall back to regular code path, as iOS doesn't provide
+ // an appropriate text style for this theme font.
+ break;
+ default:
+ textStyle = UIFontTextStyleBody;
+ break;
+ }
- if (textStyle) {
- UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
- return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
- }
+ if (textStyle) {
+ UIFontDescriptor *desc = [UIFontDescriptor preferredFontDescriptorWithTextStyle:textStyle];
+ return static_cast<CTFontDescriptorRef>(CFBridgingRetain(desc));
}
-#endif // Q_OS_IOS
+#endif // Q_OS_IOS, Q_OS_TVOS
// OSX default case and iOS fallback case
CTFontUIFontType fontType = fontTypeFromTheme(f);
@@ -948,31 +873,15 @@ void QCoreTextFontDatabase::removeApplicationFonts()
return;
foreach (const QVariant &font, m_applicationFonts) {
-#if HAVE_CORETEXT
- if (&CTFontManagerUnregisterGraphicsFont && &CTFontManagerUnregisterFontsForURL) {
- CFErrorRef error;
- if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
- CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
- } else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
- CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
- }
+ CFErrorRef error;
+ if (font.canConvert(qMetaTypeId<QCFType<CGFontRef> >())) {
+ CTFontManagerUnregisterGraphicsFont(font.value<QCFType<CGFontRef> >(), &error);
+ } else if (font.canConvert(qMetaTypeId<QCFType<CFURLRef> >())) {
+ CTFontManagerUnregisterFontsForURL(font.value<QCFType<CFURLRef> >(), kCTFontManagerScopeProcess, &error);
}
-#endif
-#if HAVE_CORETEXT && HAVE_ATS
- else
-#endif
-#if HAVE_ATS
- if (font.canConvert(qMetaTypeId<ATSFontContainerRef>())) {
- ATSFontDeactivate(font.value<ATSFontContainerRef>(), 0, kATSOptionFlagsDoNotNotify);
- }
-#endif
}
m_applicationFonts.clear();
-
-#if HAVE_ATS
- ATSFontNotify(kATSFontNotifyActionFontsChanged, 0);
-#endif
}
#ifndef QT_NO_FREETYPE
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
index 2cc6b09a15..1bc3522bda 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h
@@ -52,27 +52,20 @@
//
#include <qglobal.h>
-#define HAVE_CORETEXT QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_8, __IPHONE_4_1)
-#define HAVE_ATS QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_5, __IPHONE_NA)
#include <qpa/qplatformfontdatabase.h>
#include <qpa/qplatformtheme.h>
#include <private/qcore_mac_p.h>
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
#include <CoreGraphics/CoreGraphics.h>
#endif
-#if HAVE_CORETEXT
Q_DECLARE_METATYPE(QCFType<CGFontRef>);
Q_DECLARE_METATYPE(QCFType<CFURLRef>);
-#endif
-#if HAVE_ATS
-Q_DECLARE_METATYPE(ATSFontContainerRef);
-#endif
QT_BEGIN_NAMESPACE
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 942bb6c6bb..971f0b0cce 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -224,7 +224,7 @@ void QCoreTextFontEngine::init()
synthesisFlags = 0;
CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(ctfont);
-#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (supportsColorGlyphs() && (traits & kCTFontColorGlyphsTrait))
glyphFormat = QFontEngine::Format_ARGB;
else
@@ -258,6 +258,9 @@ void QCoreTextFontEngine::init()
} else
avgCharWidth = QFontEngine::averageCharWidth();
+ underlineThickness = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont));
+ underlinePos = -QFixed::fromReal(CTFontGetUnderlinePosition(ctfont));
+
cache_cost = (CTFontGetAscent(ctfont) + CTFontGetDescent(ctfont)) * avgCharWidth.toInt() * 2000;
// HACK hb_coretext requires both CTFont and CGFont but user_data is only void*
@@ -608,7 +611,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
if (!im.width() || !im.height())
return im;
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
#else
CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
@@ -657,7 +660,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition
CGContextShowGlyphsWithAdvances(ctx, &cgGlyph, &CGSizeZero, 1);
}
}
-#if defined(Q_OS_IOS) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
+#if defined(QT_PLATFORM_UIKIT) || MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
else if (supportsColorGlyphs()) {
// CGContextSetTextMatrix does not work with color glyphs, so we use
// the CTM instead. This means we must translate the CTM as well, to
@@ -805,6 +808,16 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co
return false;
}
+QFixed QCoreTextFontEngine::lineThickness() const
+{
+ return underlineThickness;
+}
+
+QFixed QCoreTextFontEngine::underlinePosition() const
+{
+ return underlinePos;
+}
+
QFontEngine::Properties QCoreTextFontEngine::properties() const
{
Properties result;
diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
index 67a5a3185b..27289239c6 100644
--- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
+++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h
@@ -54,7 +54,7 @@
#include <private/qfontengine_p.h>
#include <private/qcore_mac_p.h>
-#ifndef Q_OS_IOS
+#ifdef Q_OS_OSX
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>
@@ -92,6 +92,9 @@ public:
int synthesized() const Q_DECL_OVERRIDE { return synthesisFlags; }
bool supportsSubPixelPositions() const Q_DECL_OVERRIDE { return true; }
+ QFixed lineThickness() const Q_DECL_OVERRIDE;
+ QFixed underlinePosition() const Q_DECL_OVERRIDE;
+
void draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight);
FaceId faceId() const Q_DECL_OVERRIDE;
@@ -115,7 +118,7 @@ public:
static bool supportsColorGlyphs()
{
-#if defined(Q_OS_IOS)
+#if defined(QT_PLATFORM_UIKIT)
return true;
#elif MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
@@ -141,6 +144,8 @@ private:
int synthesisFlags;
CGAffineTransform transform;
QFixed avgCharWidth;
+ QFixed underlineThickness;
+ QFixed underlinePos;
QFontEngine::FaceId face_id;
mutable bool kerningPairsLoaded;
};