summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextlayout.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qtextlayout.cpp')
-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 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();