diff options
Diffstat (limited to 'src/platformsupport/fontdatabases')
3 files changed, 8 insertions, 24 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 222161734d..a87443cc85 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -45,7 +45,6 @@ #include "qcoretextfontdatabase_p.h" #include "qfontengine_coretext_p.h" #include <QtCore/QSettings> -#include <QtGui/QGuiApplication> #include <QtCore/QtEndian> #ifndef QT_NO_FREETYPE #include <QtGui/private/qfontengine_ft_p.h> @@ -399,17 +398,14 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr) } #endif + // Since we do not pass in the destination DPI to CoreText when making + // the font, we need to pass in a point size which is scaled to include + // the DPI. The default DPI for the screen is 72, thus the scale factor + // is destinationDpi / 72, but since pixelSize = pointSize / 72 * dpi, + // the pixelSize is actually the scaled point size for the destination + // DPI, and we can use that directly. qreal scaledPointSize = f.pixelSize; - // When 96 DPI is forced, the Mac plugin will use DPI 72 for some - // fonts (hardcoded in qcocoaintegration.mm) and 96 for others. This - // discrepancy makes it impossible to find the correct point size - // here without having the DPI used for the font. Until a proper - // solution (requiring API change) can be made, we simply fall back - // to passing in the point size to retain old behavior. - if (QGuiApplication::testAttribute(Qt::AA_Use96Dpi)) - scaledPointSize = f.pointSize; - CGAffineTransform matrix = qt_transform_from_fontdef(f); CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix); if (font) { @@ -725,8 +721,8 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData kATSOptionFlagsDefault, &fontContainer); } else { FSRef ref; - OSErr qt_mac_create_fsref(const QString &file, FSRef *fsref); - if (qt_mac_create_fsref(fileName, &ref) != noErr) + if (FSPathMakeRef(reinterpret_cast<const UInt8 *>(fileName.toUtf8().constData()), + &ref, 0) != noErr) return QStringList(); e = ATSFontActivateFromFileReference(&ref, kATSFontContextLocal, kATSFontFormatUnspecified, 0, kATSOptionFlagsDefault, &fontContainer); diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm index 7e1dfd9275..732aead62a 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm @@ -361,16 +361,6 @@ qreal QCoreTextFontEngine::maxCharWidth() const return bb.xoff.toReal(); } -qreal QCoreTextFontEngine::minLeftBearing() const -{ - return 0; -} - -qreal QCoreTextFontEngine::minRightBearing() const -{ - return 0; -} - void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextItemInt &ti, int paintDeviceHeight) { QVarLengthArray<QFixedPoint> positions; diff --git a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h index f8ec1d326f..1c33ae7d84 100644 --- a/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h +++ b/src/platformsupport/fontdatabases/mac/qfontengine_coretext_p.h @@ -96,8 +96,6 @@ public: QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed, const QTransform &matrix, GlyphFormat) Q_DECL_OVERRIDE; QImage bitmapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t) Q_DECL_OVERRIDE; - qreal minRightBearing() const Q_DECL_OVERRIDE; - qreal minLeftBearing() const Q_DECL_OVERRIDE; QFixed emSquareSize() const Q_DECL_OVERRIDE; bool supportsTransformation(const QTransform &transform) const Q_DECL_OVERRIDE; |