1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00

Moved fonts handling from Graphics to RenderHandler class

This commit is contained in:
Ivan Savenko
2024-09-23 15:43:11 +00:00
parent 92c5fd4156
commit 248cff49a4
21 changed files with 132 additions and 101 deletions

View File

@@ -112,9 +112,10 @@ std::vector<std::string> BattleConsole::splitText(const std::string &text)
boost::split(lines, text, boost::is_any_of("\n"));
const auto & font = GH.renderHandler().loadFont(FONT_SMALL);
for(const auto & line : lines)
{
if (graphics->fonts[FONT_SMALL]->getStringWidth(text) < pos.w)
if (font->getStringWidth(text) < pos.w)
{
output.push_back(line);
}
@@ -1098,7 +1099,8 @@ void StackQueue::StackBox::setUnit(const battle::Unit * unit, size_t turn, std::
if(currentTurn && !owner->embedded)
{
std::string tmp = std::to_string(*currentTurn);
int len = graphics->fonts[FONT_SMALL]->getStringWidth(tmp);
const auto & font = GH.renderHandler().loadFont(FONT_SMALL);
int len = font->getStringWidth(tmp);
roundRect->pos.w = len + 6;
round->setText(tmp);
}