mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Moved fonts handling from Graphics to RenderHandler class
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "../gui/Shortcut.h"
|
||||
#include "../render/Graphics.h"
|
||||
#include "../render/IFont.h"
|
||||
#include "../render/IRenderHandler.h"
|
||||
|
||||
#include "../../lib/texts/TextOperations.h"
|
||||
|
||||
@@ -190,8 +191,9 @@ void CTextInput::updateLabel()
|
||||
std::string visibleText = getVisibleText();
|
||||
|
||||
label->alignment = originalAlignment;
|
||||
const auto & font = GH.renderHandler().loadFont(label->font);
|
||||
|
||||
while (graphics->fonts[label->font]->getStringWidth(visibleText) > pos.w)
|
||||
while (font->getStringWidth(visibleText) > pos.w)
|
||||
{
|
||||
label->alignment = ETextAlignment::CENTERRIGHT;
|
||||
visibleText = visibleText.substr(TextOperations::getUnicodeCharacterSize(visibleText[0]));
|
||||
|
||||
Reference in New Issue
Block a user