diff options
author | Liang Qi <liang.qi@qt.io> | 2019-01-04 07:31:22 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-01-04 07:33:14 +0100 |
commit | 03039979b5a643f9def38a73e19835bb69384202 (patch) | |
tree | e8a9184d5963128f013247ac64ec768d1cbf6911 /src/gui/text | |
parent | 9682d217e21a2e88b6de799d79b843bbe0039df1 (diff) | |
parent | 4dc2bc323c985bdceb27f096dd6c8e7af657bb6b (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Also blacklist tst_QRawFont::unsupportedWritingSystem() and
tst_QGlyphRun::mixedScripts() on windows for now.
Conflicts:
qmake/generators/makefile.cpp
src/corelib/itemmodels/qstringlistmodel.cpp
src/platformsupport/fontdatabases/windows/qwindowsfontengine_p.h
tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp
tests/auto/gui/text/qglyphrun/BLACKLIST
tests/auto/gui/text/qrawfont/BLACKLIST
Task-number: QTBUG-72836
Change-Id: I10fea1493f0ae1a5708e1e48d0a4d7d6b76258b9
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qharfbuzzng.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 4 |
3 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index 21f880e7be..2f25aea92b 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -689,6 +689,8 @@ _hb_qt_font_create(QFontEngine *fe) hb_font_set_scale(font, QFixed(x_ppem).value(), -QFixed(y_ppem).value()); hb_font_set_ppem(font, x_ppem, y_ppem); + hb_font_set_ptem(font, fe->fontDef.pointSize); + return font; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 8de16038ad..bdb5592e9e 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -3192,6 +3192,16 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int QChar ellipsisChar(0x2026); + // We only want to use the ellipsis character if it is from the main + // font (not one of the fallbacks), since using a fallback font + // will affect the metrics of the text, potentially causing it to shift + // when it is being elided. + if (engine->type() == QFontEngine::Multi) { + QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(engine); + multiEngine->ensureEngineAt(0); + engine = multiEngine->engine(0); + } + glyph_t glyph = engine->glyphIndex(ellipsisChar.unicode()); QGlyphLayout glyphs; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index df4960e1ad..a3e194f835 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2607,6 +2607,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR Qt::IntersectClip); else x /= 2; // Centered + p->setFont(f); p->drawText(QPointF(iterator.x.toReal() + x, y.toReal()), visualTab); } @@ -2680,8 +2681,11 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR if (c.style() != Qt::NoBrush) p->setPen(c.color()); QChar visualSpace(si.analysis.flags == QScriptAnalysis::Space ? (ushort)0xb7 : (ushort)0xb0); + QFont oldFont = p->font(); + p->setFont(eng->font(si)); p->drawText(QPointF(iterator.x.toReal(), itemBaseLine.toReal()), visualSpace); p->setPen(pen); + p->setFont(oldFont); } } eng->drawDecorations(p); |