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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user