Reset text containers on language change

Fix text containers rendering broken text after the language is changed, as this cleared the glyph atlas without clearing the references to the glyph positions in the text containers. Now `OnWindowResize` is also called on language change to reset all text containers.

However, the glyph atlas is not cleared on normal window resize anymore, because this seems to be unnecessary.
This commit is contained in:
Robert Müller 2023-08-14 18:52:45 +02:00
parent b9355880b3
commit f90e908c9d
4 changed files with 2 additions and 9 deletions

View file

@ -2341,8 +2341,6 @@ public:
}
dbg_assert(!HasNonEmptyTextContainer, "text container was not empty");
m_pGlyphMap->Clear();
}
};

View file

@ -990,7 +990,8 @@ void CGameClient::HandleLanguageChanged()
g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console());
TextRender()->SetFontLanguageVariant(g_Config.m_ClLanguagefile);
UI()->OnLanguageChange();
// Clear all text containers
OnWindowResize();
}
void CGameClient::RenderShutdownMessage()

View file

@ -174,11 +174,6 @@ void CUI::OnWindowResize()
OnElementsReset();
}
void CUI::OnLanguageChange()
{
OnElementsReset();
}
void CUI::OnCursorMove(float X, float Y)
{
if(!CheckMouseLock())

View file

@ -390,7 +390,6 @@ public:
void AddUIElement(CUIElement *pElement);
void OnElementsReset();
void OnWindowResize();
void OnLanguageChange();
void OnCursorMove(float X, float Y);
void SetEnabled(bool Enabled) { m_Enabled = Enabled; }