From 353c12f3e6c97d7059365dcf9b1f2dd9aa484545 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 28 Sep 2011 12:36:39 +0200 Subject: Register whether a glyph run goes from RTL or LTR This is needed by scene graph when embedding text objects in RTL text. Since the number of flags required for QGlyphRun is increasing, I've also refactored the underline/overline/strikethrough settings to use a common QFlags interface. Task-number: QTBUG-20917 Change-Id: I070649c014f4a51cfd66a9579d2d221a8f22302f Reviewed-on: http://codereview.qt-project.org/5739 Reviewed-by: Qt Sanity Bot Reviewed-by: Jiang Jiang --- src/gui/text/qtextlayout.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gui/text/qtextlayout.cpp') diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 00206ba624..e1bbca609e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1022,6 +1022,8 @@ QList QTextLayout::glyphRuns(int from, int length) const flags |= QTextItem::Overline; if (glyphRun.strikeOut()) flags |= QTextItem::StrikeOut; + if (glyphRun.isRightToLeft()) + flags |= QTextItem::RightToLeft; QPair key(fontEngine, int(flags)); // merge the glyph runs using the same font if (glyphRunHash.contains(key)) { @@ -2181,6 +2183,8 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g glyphRun.setOverline(flags.testFlag(QTextItem::Overline)); glyphRun.setUnderline(flags.testFlag(QTextItem::Underline)); glyphRun.setStrikeOut(flags.testFlag(QTextItem::StrikeOut)); + if (flags.testFlag(QTextItem::RightToLeft)) + glyphRun.setRightToLeft(true); glyphRun.setRawFont(font); glyphRun.setBoundingRect(QRectF(selectionX.toReal(), minY, selectionWidth.toReal(), height)); -- cgit v1.2.3