diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-10 13:44:37 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-03-10 14:15:15 (GMT) |
commit | ef9e7168a8ed3e8149204cf6c604a38db35245c0 (patch) | |
tree | 9348150c113f2db7f7cefa566ac45a5cd56839a2 /src/gui/text | |
parent | ce1d5d10d0316a05a2bfce09239fd532a2d5ca7e (diff) | |
download | Qt-ef9e7168a8ed3e8149204cf6c604a38db35245c0.zip Qt-ef9e7168a8ed3e8149204cf6c604a38db35245c0.tar.gz Qt-ef9e7168a8ed3e8149204cf6c604a38db35245c0.tar.bz2 |
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
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qfontengine_mac.mm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index 48bc635..8588214 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; |