aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/Text.cpp b/src/Text.cpp
index 9650964..6512c48 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -743,20 +743,25 @@ namespace QuickMedia
sf::Vector2f pos = position;
- sf::Font *latin_font;
+ FontLoader::FontType latin_font_type;
if(bold_font)
- latin_font = FontLoader::get_font(FontLoader::FontType::LATIN_BOLD);
+ latin_font_type = FontLoader::FontType::LATIN_BOLD;
else
- latin_font = FontLoader::get_font(FontLoader::FontType::LATIN);
+ latin_font_type = FontLoader::FontType::LATIN;
+ sf::Font *latin_font = FontLoader::get_font(latin_font_type);
const float vspace = latin_font->getLineSpacing(characterSize);
pos.y += floor(vspace); // Origin is at bottom left, we want it to be at top left
- const sf::Font *fonts[] = { latin_font, FontLoader::get_font(FontLoader::FontType::CJK) };
+ const FontLoader::FontType font_types[] = { latin_font_type, FontLoader::FontType::CJK };
for(size_t i = 0; i < 2; ++i) {
+ if(vertices[i].getVertexCount() == 0)
+ continue;
+
+ sf::Font *font = FontLoader::get_font(font_types[i]);
sf::RenderStates states;
states.transform.translate(pos);
- states.texture = &fonts[i]->getTexture(characterSize);
+ states.texture = &font->getTexture(characterSize);
target.draw(vertices[i], states);
}