summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/fontdatabases
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-01-21 12:55:42 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>2015-01-22 09:32:44 +0100
commit586fd042345b619acceafb13e84b912863961e56 (patch)
tree6a8634f7fe3eb31d79474e1a8ade300a69622379 /src/platformsupport/fontdatabases
parent0c4c841ce8cd3a3b8ebc636dd41f7c7a2011991d (diff)
OS X/iOS: Fix stretched font rendering
Setting the stretch of a QFont did not work correctly on OS X or iOS. Two things are needed to make it work: First of all, we need to properly set the transform when creating the CTFont. In addition, we need to manually scale the advances, as CTRunGetPositions() does not do this for us. On OS X 10.6, however, there was a regression and CTRunGetPositions() would return scaled positions, so we exclude the step to scale the advances on this particular version. This is an adaptation of bc25cfdd65452efa226cbd544c9ae9803eb6748a in Qt 4. [ChangeLog][QtGui][OS X/iOS] Fixed a bug when rendering fonts that were set to be stretched. Task-number: QTBUG-43801 Change-Id: I4902a9f5e29299761e3c2c5c6d6d80ee1dea1a25 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/platformsupport/fontdatabases')
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 5a6c5de0b4..fe408305e0 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -370,6 +370,8 @@ void QCoreTextFontDatabase::releaseHandle(void *handle)
CFRelease(CTFontDescriptorRef(handle));
}
+extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
+
QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr)
{
qreal scaledPointSize = f.pixelSize;
@@ -384,7 +386,8 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr)
scaledPointSize = f.pointSize;
CTFontDescriptorRef descriptor = (CTFontDescriptorRef) usrPtr;
- CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, NULL);
+ CGAffineTransform matrix = qt_transform_from_fontdef(f);
+ CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix);
if (font) {
QFontEngine *engine = new QCoreTextFontEngine(font, f);
engine->fontDef = f;