diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-04-27 05:22:20 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-04-27 05:22:20 (GMT) |
commit | dcf9a1f2f20248de0da9549af54bc3a4844eaf5b (patch) | |
tree | c9eee3ff39000816113bcab3a5c035da97c2a9fc /src/gui/text/qtextengine.cpp | |
parent | 47712d1f330e4b22ce6dd30e7557288ef7f7fca0 (diff) | |
parent | 415951891cd75170f1e4b89b46effa3319b56e4e (diff) | |
download | Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.zip Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.tar.gz Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.tar.bz2 |
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt into 4.7
Diffstat (limited to 'src/gui/text/qtextengine.cpp')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index b511b5a..4f86cff 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1233,6 +1233,8 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const shaper_item.num_glyphs -= itemBoundaries[k + 1]; } shaper_item.initialGlyphCount = shaper_item.num_glyphs; + if (shaper_item.num_glyphs < shaper_item.item.length) + shaper_item.num_glyphs = shaper_item.item.length; QFontEngine *actualFontEngine = font; uint engineIdx = 0; @@ -1257,7 +1259,8 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const } const QGlyphLayout g = availableGlyphs(&si).mid(glyph_pos); - moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); + if (shaper_item.num_glyphs > shaper_item.item.length) + moveGlyphData(g.mid(shaper_item.num_glyphs), g.mid(shaper_item.initialGlyphCount), remaining_glyphs); shaper_item.glyphs = g.glyphs; shaper_item.attributes = g.attributes; @@ -2678,6 +2681,22 @@ void QTextEngine::resolveAdditionalFormats() const specialData->resolvedFormatIndices = indices; } +QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line) +{ + if (!line.hasTrailingSpaces + || (option.flags() & QTextOption::IncludeTrailingSpaces) + || !isRightToLeft()) + return QFixed(); + + int pos = line.length; + const HB_CharAttributes *attributes = this->attributes(); + if (!attributes) + return QFixed(); + while (pos > 0 && attributes[line.from + pos - 1].whiteSpace) + --pos; + return width(line.from + pos, line.length - pos); +} + QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f) : QTextEngine(string, f), _layoutData(string, _memory, MemSize) |