diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-29 16:20:59 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-07-29 16:20:59 (GMT) |
commit | c9fb043d9fa38dd8eec6976e7a338dc89ddc5b0e (patch) | |
tree | 69a3f39667e0ff22a3d7507fafcdb7c9cd219daf /src/gui/text/qtextlayout.cpp | |
parent | c9f0c578bbaf73211ad4729e1496e53867a641c9 (diff) | |
parent | 29a5089b83b1b43ecf2c746dac8cadbbe4385553 (diff) | |
download | Qt-c9fb043d9fa38dd8eec6976e7a338dc89ddc5b0e.zip Qt-c9fb043d9fa38dd8eec6976e7a338dc89ddc5b0e.tar.gz Qt-c9fb043d9fa38dd8eec6976e7a338dc89ddc5b0e.tar.bz2 |
Merge branch 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration:
Revert binary search in QTextEngine::findItem
Remove a duplicate include line
Save previous font engine for right bearing adjustment
Symbian^3 workaround: Avoid usage of linked fonts.
Fix compilation under OSX 10.7 or using llvm-gcc.
Fix typo in QFontDialog docs
Reset previousGlyph once we reached a new text item
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 3f0b9e8..4fd6ddf 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(); |