From b0f23457d736baf99a2f7460d1942da632cc6a15 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 1 Jun 2011 11:37:27 +0200 Subject: [PATCH] Fix Text's underline, overline and strikeout properties for plain text. --- src/declarative/items/qsgtextnode.cpp | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/declarative/items/qsgtextnode.cpp b/src/declarative/items/qsgtextnode.cpp index 33325a1..876c978 100644 --- a/src/declarative/items/qsgtextnode.cpp +++ b/src/declarative/items/qsgtextnode.cpp @@ -167,6 +167,13 @@ QSGGlyphNode *QSGTextNode::addGlyphs(const QPointF &position, const QGlyphRun &g appendChildNode(node); + if (glyphs.overline() || glyphs.strikeOut() || glyphs.underline()) { + QPointF baseLine = node->baseLine(); + qreal width = node->boundingRect().width(); + addTextDecorations(baseLine, glyphs.rawFont(), color, width, + glyphs.overline(), glyphs.strikeOut(), glyphs.underline()); + } + return node; } @@ -193,13 +200,6 @@ void QSGTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout QRawFont font = glyphs.rawFont(); addGlyphs(position + QPointF(0, font.ascent()), glyphs, color, style, styleColor); } - - QFont font = textLayout->font(); - QRawFont rawFont = QRawFont::fromFont(font); - if (font.strikeOut() || font.underline() || font.overline()) { - addTextDecorations(position, rawFont, color, textLayout->boundingRect().width(), - font.overline(), font.strikeOut(), font.underline()); - } } @@ -360,13 +360,8 @@ void QSGTextNode::addTextBlock(const QPointF &position, QTextDocument *textDocum for (int i=0; ibaseLine(); - qreal width = glyphNode->boundingRect().width(); - addTextDecorations(baseLine, font, color, width, - glyphs.overline(), glyphs.strikeOut(), glyphs.underline()); + addGlyphs(position + blockPosition + QPointF(0, font.ascent()), + glyphs, color, style, styleColor); } } -- 1.7.2.5