diff options
author | Stefan Hundhammer <Stefan.Hundhammer@gmx.de> | 2012-03-01 17:14:38 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 13:14:05 +0100 |
commit | 21c98e52c5aab6f063457729ac8344134071f0c5 (patch) | |
tree | 506b745caa4e05fcf672d755912726426bde480c /src/gui/text/qtextlayout.cpp | |
parent | c4342ddea083baf0ba7a22df6ce672f0fbcc04c2 (diff) |
Line up underlines if fallback fonts are used (QTBUG-21832)
Change-Id: Icecc514f6c47c0576af8cabd39cdc0987f8d93fa
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index d5b05a8957..56098b0bdb 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -60,6 +60,7 @@ #include <qdebug.h> #include "qfontengine_p.h" +#include <private/qpainter_p.h> QT_BEGIN_NAMESPACE @@ -2062,7 +2063,7 @@ static void drawMenuText(QPainter *p, QFixed x, QFixed y, const QScriptItem &si, if (rtl) x -= w; if (gf.num_chars) - p->drawTextItem(QPointF(x.toReal(), y.toReal()), gf); + QPainterPrivate::get(p)->drawTextItem(QPointF(x.toReal(), y.toReal()), gf, eng); if (!rtl) x += w; if (ul && *ul != -1 && *ul < end) { @@ -2083,7 +2084,7 @@ static void drawMenuText(QPainter *p, QFixed x, QFixed y, const QScriptItem &si, gf.underlineStyle = QTextCharFormat::SingleUnderline; if (rtl) x -= w; - p->drawTextItem(QPointF(x.toReal(), y.toReal()), gf); + QPainterPrivate::get(p)->drawTextItem(QPointF(x.toReal(), y.toReal()), gf, eng); if (!rtl) x += w; gf.underlineStyle = QTextCharFormat::NoUnderline; @@ -2379,6 +2380,8 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR QTextLineItemIterator iterator(eng, index, pos, selection); QFixed lineBase = line.base(); + eng->clearDecorations(); + eng->enableDelayDecorations(); const QFixed y = QFixed::fromReal(pos.y()) + line.y + lineBase; @@ -2451,7 +2454,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR gf.chars = 0; gf.num_chars = 0; gf.width = iterator.itemWidth; - p->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf); + QPainterPrivate::get(p)->drawTextItem(QPointF(iterator.x.toReal(), y.toReal()), gf, eng); if (eng->option.flags() & QTextOption::ShowTabsAndSpaces) { QChar visualTab(0x2192); int w = QFontMetrics(f).width(visualTab); @@ -2529,7 +2532,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR } else { if (noText) gf.glyphs.numGlyphs = 0; // slightly less elegant than it should be - p->drawTextItem(pos, gf); + QPainterPrivate::get(p)->drawTextItem(pos, gf, eng); } } if (si.analysis.flags == QScriptAnalysis::Space @@ -2542,7 +2545,7 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR p->setPen(pen); } } - + eng->drawDecorations(p); if (eng->hasFormats()) p->setPen(pen); |