From f0fec34dc9c2dbc86dd424e4963983cbb2ed9b41 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 21 Jun 2023 22:29:40 +1000 Subject: The Fontpocalypse I hate it --- source/rendering/StarFontTextureGroup.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source/rendering/StarFontTextureGroup.cpp') diff --git a/source/rendering/StarFontTextureGroup.cpp b/source/rendering/StarFontTextureGroup.cpp index b576ef8..d8c14d0 100644 --- a/source/rendering/StarFontTextureGroup.cpp +++ b/source/rendering/StarFontTextureGroup.cpp @@ -13,13 +13,21 @@ void FontTextureGroup::cleanup(int64_t timeout) { } void FontTextureGroup::switchFont(String const& font) { - if (m_fontName != font) { + if (font.empty()) { + m_font = m_defaultFont; + m_fontName.clear(); + } + else if (m_fontName != font) { m_fontName = font; auto find = m_fonts.find(font); m_font = find != m_fonts.end() ? find->second : m_defaultFont; } } +String const& FontTextureGroup::activeFont() { + return m_fontName; +} + void FontTextureGroup::addFont(FontPtr const& font, String const& name, bool default) { m_fonts[name] = font; if (default) -- cgit v1.2.3