aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgadaptationlayer.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2016-10-20 13:39:48 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-10-21 12:33:47 +0000
commitac6a26a3888a6fb767d492ddd2edabf5881c997f (patch)
tree871b0fa2d8a9cdf801a9ab5276adeab306ec06bb /src/quick/scenegraph/qsgadaptationlayer.cpp
parent2eda16de8857b739b1d24e9137292301d2191275 (diff)
Windows: Fix distance field rendering with fonts with broken cmap
If the CMAP table of a font is not present on Windows, then the font will not be counted as a ttf file, likewise if the CMAP table has a bug in it. An effect of this is that the glyphCount() will be returned as 0 since we will bail out before fetching the maxp table, and the distance field renderer assumes the glyph count is valid. While the font in question is obviously broken and may have other issues, it is possible to still support using it for rendering text by bypassing the check when we cannot get a reliable glyph count from the font. [ChangeLog][Windows][Text] Worked around an issue with fonts that have corrupt cmap tables. Task-number: QTBUG-45321 Change-Id: I9cfd7809661ae6b902f6b9d47ffb18bfbc06bcd4 Reviewed-by: Yoann Lopes <yoann.lopes@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer.cpp')
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index e219ddd82e..9923fa6e24 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -122,7 +122,7 @@ void QSGDistanceFieldGlyphCache::populate(const QVector<glyph_t> &glyphs)
int count = glyphs.count();
for (int i = 0; i < count; ++i) {
glyph_t glyphIndex = glyphs.at(i);
- if ((int) glyphIndex >= glyphCount()) {
+ if ((int) glyphIndex >= glyphCount() && glyphCount() > 0) {
qWarning("Warning: distance-field glyph is not available with index %d", glyphIndex);
continue;
}