summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-07-27 12:12:04 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-07-27 12:12:04 (GMT)
commit15d36189d0dcc5c97deadcf83bc072873726d449 (patch)
tree4adbf3c994570d123922521ed5df85238289065e /src/gui/text
parentd380d36a84a2b5814e7b06d28a5cc68866e9fd2b (diff)
parentcc500b182e26d53ca16136f24a06a111f4374425 (diff)
downloadQt-15d36189d0dcc5c97deadcf83bc072873726d449.zip
Qt-15d36189d0dcc5c97deadcf83bc072873726d449.tar.gz
Qt-15d36189d0dcc5c97deadcf83bc072873726d449.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Save previous font engine for right bearing adjustment 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')
-rw-r--r--src/gui/text/qtextlayout.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 183bcea..d180f0e 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1715,6 +1715,7 @@ namespace {
QFixed minimumRightBearing;
QFontEngine *fontEngine;
+ QFontEngine *previousFontEngine;
const unsigned short *logClusters;
bool manualWrap;
@@ -1735,12 +1736,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;
}
}
@@ -1760,8 +1768,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()
@@ -1851,7 +1862,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();