summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine_mac.mm18
-rw-r--r--src/gui/text/qfontengine_p.h3
2 files changed, 15 insertions, 6 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 3cf72d7..3a22aaf 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -161,9 +161,14 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, con
QCFString name;
ATSFontGetName(atsFontRef, kATSOptionFlagsDefault, &name);
+ transform = CGAffineTransformIdentity;
+ if (fontDef.stretch != 100) {
+ transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1);
+ }
+
QCFType<CTFontDescriptorRef> descriptor = CTFontDescriptorCreateWithNameAndSize(name, fontDef.pixelSize);
- QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, 0);
- ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, 0, symbolicTraits, symbolicTraits);
+ QCFType<CTFontRef> baseFont = CTFontCreateWithFontDescriptor(descriptor, fontDef.pixelSize, &transform);
+ ctfont = CTFontCreateCopyWithSymbolicTraits(baseFont, fontDef.pixelSize, &transform, symbolicTraits, symbolicTraits);
// CTFontCreateCopyWithSymbolicTraits returns NULL if we ask for a trait that does
// not exist for the given font. (for example italic)
@@ -358,7 +363,10 @@ QCoreTextFontEngine::QCoreTextFontEngine(CTFontRef font, const QFontDef &def,
if (fontDef.style != QFont::StyleNormal && !(traits & kCTFontItalicTrait)) {
synthesisFlags |= SynthesizedItalic;
}
-
+ transform = CGAffineTransformIdentity;
+ if (fontDef.stretch != 100) {
+ transform = CGAffineTransformMakeScale(float(fontDef.stretch) / float(100), 1);
+ }
QByteArray os2Table = getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
if (os2Table.size() >= 10)
fsType = qFromBigEndian<quint16>(reinterpret_cast<const uchar *>(os2Table.constData() + 8));
@@ -462,7 +470,7 @@ void QCoreTextFontEngine::draw(CGContextRef ctx, qreal x, qreal y, const QTextIt
if (synthesisFlags & QFontEngine::SynthesizedItalic)
cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, -tanf(14 * acosf(0) / 90), 1, 0, 0));
-// ### cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
+ cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
CGContextSetTextMatrix(ctx, cgMatrix);
@@ -585,7 +593,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, int margin, bool aa)
if (synthesisFlags & QFontEngine::SynthesizedItalic)
cgMatrix = CGAffineTransformConcat(cgMatrix, CGAffineTransformMake(1, 0, tanf(14 * acosf(0) / 90), 1, 0, 0));
-// ### cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
+ cgMatrix = CGAffineTransformConcat(cgMatrix, transform);
CGContextSetTextMatrix(ctx, cgMatrix);
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index ad5dfd8..f8ee93f 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -462,6 +462,7 @@ private:
CGFontRef cgFont;
QCoreTextFontEngineMulti *parentEngine;
int synthesisFlags;
+ CGAffineTransform transform;
friend class QCoreTextFontEngineMulti;
};
@@ -493,7 +494,7 @@ private:
uint fontIndexForFont(CTFontRef id) const;
CTFontRef ctfont;
mutable QCFType<CFMutableDictionaryRef> attributeDict;
-
+ CGAffineTransform transform;
friend class QFontDialogPrivate;
};
# endif //MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5