summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-10 14:44:37 +0100
committerSamuli Piippo <samuli.piippo@digia.com>2011-06-09 13:05:08 +0300
commitf58e2a34e2815e359ee83f2029b8044f3d43203f (patch)
tree946681e15d225e66e7dd2aa18107605fad4a3d8e /src
parent0c5d0fbc9f15c2b0f59851d64584a8183f8b4ff5 (diff)
downloadqt4-tools-f58e2a34e2815e359ee83f2029b8044f3d43203f.tar.gz
Cocoa: Fix misaligned text between format changes
This reverts part of commit e008504b5ec34975e34adf3b1a2b7170d0e4dd38. The original commit aimed to round up all fractional numbers for the font to "improve appearance". Rounding up the last advance of a set of advances in a glyph layout, however, breaks text layout completely, since the layout of text will be different depending on how many text lines is used to represent it (since the last glyph in each line will have a higher advance than the others.) This was e.g. visible in Qt Creator when turning on whitespace visualization, as all spaces then created a format change, thus a new text line in the text layout, and hence an increase of X pixels in the positioning of the text after the space, where 0.0 < X < 1.0. I see no negative results of removing the rounding, but if there are any problems, it has to be fixed in the usage of the advances not in the advances themselves. Task-number: QTCREATORBUG-381, QTBUG-8791 Reviewed-by: mae (cherry picked from commit ef9e7168a8ed3e8149204cf6c604a38db35245c0)
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qfontengine_mac.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 01d46c788b..3cf72d7635 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -308,7 +308,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
CTFontGetAdvancesForGlyphs(runFont, kCTFontHorizontalOrientation, tmpGlyphs + glyphCount - 1, &lastGlyphAdvance, 1);
outGlyphs[rtl ? 0 : (glyphCount - 1)] = tmpGlyphs[glyphCount - 1] | fontIndex;
- outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(lastGlyphAdvance.width).ceil();
+ outAdvances_x[rtl ? 0 : (glyphCount - 1)] = QFixed::fromReal(lastGlyphAdvance.width);
}
outGlyphs += glyphCount;
outAttributes += glyphCount;