diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-07-29 17:43:07 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-07-29 17:43:07 +0200 |
commit | 29a5089b83b1b43ecf2c746dac8cadbbe4385553 (patch) | |
tree | 69a3f39667e0ff22a3d7507fafcdb7c9cd219daf /src/gui/text/qtextlayout.cpp | |
parent | c9f0c578bbaf73211ad4729e1496e53867a641c9 (diff) | |
parent | 174e01a16aba71cfaa7b095be6430f8e4a89d0b8 (diff) | |
download | qt4-tools-29a5089b83b1b43ecf2c746dac8cadbbe4385553.tar.gz |
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts:
src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
src/gui/text/qfont_s60.cpp
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3f0b9e8f7d..4fd6ddf0c1 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1591,6 +1591,7 @@ namespace { QFixed minimumRightBearing; QFontEngine *fontEngine; + QFontEngine *previousFontEngine; const unsigned short *logClusters; bool manualWrap; @@ -1611,12 +1612,19 @@ namespace { return glyphs.glyphs[logClusters[currentPosition - 1]]; } - inline void saveCurrentGlyph() + inline void resetPreviousGlyph() { previousGlyph = 0; + previousFontEngine = 0; + } + + inline void saveCurrentGlyph() + { + resetPreviousGlyph(); if (currentPosition > 0 && logClusters[currentPosition - 1] < glyphs.numGlyphs) { previousGlyph = currentGlyph(); // needed to calculate right bearing later + previousFontEngine = fontEngine; } } @@ -1636,8 +1644,11 @@ namespace { inline void adjustPreviousRightBearing() { - if (previousGlyph > 0) - adjustRightBearing(previousGlyph); + if (previousGlyph > 0 && previousFontEngine) { + qreal rb; + previousFontEngine->getGlyphBearings(previousGlyph, 0, &rb); + rightBearing = qMin(QFixed(), QFixed::fromReal(rb)); + } } inline void resetRightBearing() @@ -1728,7 +1739,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.currentPosition = line.from; int end = 0; lbh.logClusters = eng->layoutData->logClustersPtr; - lbh.previousGlyph = 0; + lbh.resetPreviousGlyph(); while (newItem < eng->layoutData->items.size()) { lbh.resetRightBearing(); |