diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-07-08 13:39:36 +0200 |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-07-08 14:00:38 +0200 |
commit | c5f3ea858679d07d753e29af87f04efadd7683e9 (patch) | |
tree | 0234f1e8342fd139fabc9498e2e7c5f80d414e3c /src/gui/text/qfontengine_coretext.mm | |
parent | 8b66982ec7b4b5d2071931c288973dce73dc9875 (diff) |
Use truncate only for subpixel boundingBox x position
Since Lion, Core Text starts to return fractional values for
x origin in the glyph bounding box. To get correct alignment
we need to make it integer, it seems that round will cut certain
pixels (x = 0.6 will be round to 1, then that glyph will be moved
too much to the left in image glyph cache). Reverting 4297b85a
appears to work fine on previous version of Mac OS X as well.
This change will not affect Windows (DirectWrite) and FreeType
font engines since they both return integer values for that.
Reviewed-by: Eskil
Diffstat (limited to 'src/gui/text/qfontengine_coretext.mm')
-rw-r--r-- | src/gui/text/qfontengine_coretext.mm | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 6a9201dd4c..64d4a2453c 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -751,7 +751,7 @@ QImage QCoreTextFontEngine::imageForGlyph(glyph_t glyph, QFixed subPixelPosition CGContextSetFont(ctx, cgFont); - qreal pos_x = -br.x.round().truncate() + subPixelPosition.toReal(); + qreal pos_x = -br.x.truncate() + subPixelPosition.toReal(); qreal pos_y = im.height() + br.y.toReal(); CGContextSetTextPosition(ctx, pos_x, pos_y); |