summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-03-19 13:50:46 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2019-03-20 08:04:52 +0000
commit667f031953b94714f77765405905e6636fee038c (patch)
tree7dc03eb8486772fb557bf8bcbd92dde37f3a0faf /src
parent28cdc759c4e902b858efdc3f1718318ca4cbf380 (diff)
macOS: Fix overlapping glyphs
There is a bug in Qt which will scale advances by 0% on macOS when the font used is loaded directly through QRawFont and set directly on a QTextLayout, as the adjustments usually done in QFont and the font database are not applied. This will be fixed in Qt 5.12.3, but since we also have to support Qt 5.12.2, we add a work-around which sets the stretch to 100% for all the fonts loaded. Task-number: QT3DS-3132 Change-Id: Ic908cd47dfdcc808544f7e28c08d4dba45342105 Reviewed-by: Kimmo Leppälä <kimmo.leppala@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/runtime/q3dsfontdatabase.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/runtime/q3dsfontdatabase.cpp b/src/runtime/q3dsfontdatabase.cpp
index 384bf68..98f2c91 100644
--- a/src/runtime/q3dsfontdatabase.cpp
+++ b/src/runtime/q3dsfontdatabase.cpp
@@ -30,6 +30,7 @@
#include "q3dsfontdatabase_p.h"
#include <QtCore/qdir.h>
+#include <QtGui/private/qrawfont_p.h>
#if QT_VERSION >= QT_VERSION_CHECK(5,12,2)
@@ -90,8 +91,17 @@ QRawFont Q3DSFontDatabase::findFont(const QString &fontId)
{
for (Font &font : m_fonts) {
if (font.fontId == fontId) {
- if (!font.rawFont.isValid())
+ if (!font.rawFont.isValid()) {
font.rawFont = QRawFont(font.filePath, 16);
+
+#if QT_VERSION < QT_VERSION_CHECK(5,12,3)
+ // Work-around for Q3DS-3132
+ if (font.rawFont.isValid()) {
+ QRawFontPrivate *d = QRawFontPrivate::get(font.rawFont);
+ d->fontEngine->fontDef.stretch = 100;
+ }
+#endif
+ }
return font.rawFont;
}
}