Support overlapping contours in glyph rasterizer fallback

Truetype fonts should be rasterized with a winding fill
as documented in e.g. Microsoft's specs.

Failing to do this caused a bug when doing native
rendering in Qt Quick for fonts that were large enough
that the fallback path was taken when drawing the glyphs
into the cache. If the glyph had overlapping contours,
they would be subtracted from the shape.

[ChangeLog][Text] Fixed an uncommon rendering error with
fonts containing overlapping contours.

Task-number: QTBUG-41197
Change-Id: I0e4a4432ba3f902bc3ea59d8f4dbd12a295630b2
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2015-10-23 17:17:11 +02:00
parent 1721c83c27
commit 4f4da7462b

View File

@ -960,6 +960,7 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
pt.x = -glyph_x;
pt.y = -glyph_y; // the baseline
QPainterPath path;
path.setFillRule(Qt::WindingFill);
QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
im.fill(Qt::transparent);
QPainter p(&im);