fix glyphs that have no pixels but an advance (e.g. spaces)

This commit is contained in:
Konstantin Käfer
2014-03-24 15:19:39 +01:00
parent 84ea95988c
commit 8b573f9fa2
3 changed files with 3 additions and 3 deletions

View File

@@ -30,7 +30,7 @@ struct Glyph {
: rect(rect), metrics(metrics) {}
operator bool() const {
return !metrics;
return !metrics && !rect;
}
const Rect<uint16_t> rect;

View File

@@ -9,7 +9,7 @@ struct Rect {
T x = 0, y = 0;
T w = 0, h = 0;
operator bool() const { return w == 0 && h == 0; }
operator bool() const { return w == 0 || h == 0; }
};
}

View File

@@ -39,7 +39,7 @@ Rect<uint16_t> GlyphAtlas::addGlyph(uint64_t tile_id, const std::string& face_na
}
// The glyph bitmap has zero width.
if (!glyph.metrics.width) {
if (!glyph.bitmap.size()) {
return Rect<uint16_t>{ 0, 0, 0, 0 };
}