Last active
November 24, 2015 15:18
-
-
Save MatthewWilkes/594f48fd0b53a50549e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | |
index 0460f11..c147897 100644 | |
--- a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | |
+++ b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm | |
@@ -691,7 +691,14 @@ void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shap | |
QFontEngine::FaceId QCoreTextFontEngine::faceId() const | |
{ | |
- return QFontEngine::FaceId(); | |
+ FaceId result; | |
+ result.index = 0; | |
+ | |
+ CFStringRef name = CTFontCopyName(ctfont, kCTFontUniqueNameKey); | |
+ result.filename = QCFString::toQString(name).toUtf8(); | |
+ CFRelease(name); | |
+ | |
+ return result; | |
} | |
bool QCoreTextFontEngine::canRender(const QChar *string, int len) const | |
@@ -735,4 +742,36 @@ bool QCoreTextFontEngine::supportsTransformation(const QTransform &transform) co | |
return false; | |
} | |
+QFontEngine::Properties QCoreTextFontEngine::properties() const | |
+{ | |
+ Properties result; | |
+ | |
+ CFStringRef psName, copyright; | |
+ psName = CTFontCopyPostScriptName(ctfont); | |
+ copyright = CTFontCopyName(ctfont, kCTFontCopyrightNameKey); | |
+ result.postscriptName = QCFString::toQString(psName).toUtf8(); | |
+ result.copyright = QCFString::toQString(copyright).toUtf8(); | |
+ CFRelease(psName); | |
+ CFRelease(copyright); | |
+ | |
+ CGRect cgRect = CTFontGetBoundingBox(ctfont); | |
+ result.boundingBox = QRectF(cgRect.origin.x, cgRect.origin.y, cgRect.size.width, cgRect.size.height); | |
+ | |
+ result.emSquare = emSquareSize(); | |
+ result.ascent = ascent(); | |
+ result.descent = descent(); | |
+ result.leading = leading(); | |
+ result.italicAngle = QFixed::fromReal(CTFontGetSlantAngle(ctfont)); | |
+ result.capHeight = QFixed::fromReal(CTFontGetCapHeight(ctfont)); | |
+ result.lineWidth = QFixed::fromReal(CTFontGetUnderlineThickness(ctfont)); | |
+ | |
+ if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { | |
+ result.italicAngle = result.italicAngle.round(); | |
+ result.capHeight = result.capHeight.round(); | |
+ result.lineWidth = result.lineWidth.round(); | |
+ } | |
+ | |
+ return result; | |
+} | |
+ | |
QT_END_NAMESPACE | |
diff --git a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h | |
index b9593b9..30fa4cf 100644 | |
--- a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h | |
+++ b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h | |
@@ -103,6 +103,8 @@ public: | |
virtual QFontEngine *cloneWithSize(qreal pixelSize) const; | |
virtual int glyphMargin(QFontEngine::GlyphFormat format) { Q_UNUSED(format); return 0; } | |
+ virtual QFontEngine::Properties properties() const; | |
+ | |
static bool supportsColorGlyphs() | |
{ | |
#if defined(Q_OS_IOS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment