From 8b573f9fa29b724206c9ec0592525421d3e273c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Mon, 24 Mar 2014 15:19:39 +0100 Subject: [PATCH] fix glyphs that have no pixels but an advance (e.g. spaces) --- include/llmr/text/glyph.hpp | 2 +- include/llmr/util/rect.hpp | 2 +- src/geometry/glyph_atlas.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/llmr/text/glyph.hpp b/include/llmr/text/glyph.hpp index 09b4ddb5a..91531e24f 100644 --- a/include/llmr/text/glyph.hpp +++ b/include/llmr/text/glyph.hpp @@ -30,7 +30,7 @@ struct Glyph { : rect(rect), metrics(metrics) {} operator bool() const { - return !metrics; + return !metrics && !rect; } const Rect rect; diff --git a/include/llmr/util/rect.hpp b/include/llmr/util/rect.hpp index 025f3a9cb..56bab2c9c 100644 --- a/include/llmr/util/rect.hpp +++ b/include/llmr/util/rect.hpp @@ -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; } }; } diff --git a/src/geometry/glyph_atlas.cpp b/src/geometry/glyph_atlas.cpp index df62ced8b..f5eb59f56 100644 --- a/src/geometry/glyph_atlas.cpp +++ b/src/geometry/glyph_atlas.cpp @@ -39,7 +39,7 @@ Rect 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{ 0, 0, 0, 0 }; }