1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +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

@@ -19,6 +19,7 @@
#include "../gui/Shortcut.h"
#include "../render/Graphics.h"
#include "../render/IFont.h"
#include "../render/IRenderHandler.h"
#include "../widgets/CComponent.h"
#include "../widgets/ComboBox.h"
#include "../widgets/Buttons.h"
@@ -357,8 +358,9 @@ std::shared_ptr<CMultiLineLabel> InterfaceObjectConfigurable::buildMultiLineLabe
auto color = readColor(config["color"]);
auto text = readText(config["text"]);
Rect rect = readRect(config["rect"]);
const auto & fontPtr = GH.renderHandler().loadFont(font);
if(!config["adoptHeight"].isNull() && config["adoptHeight"].Bool())
rect.h = graphics->fonts[font]->getLineHeight() * 2;
rect.h = fontPtr->getLineHeight() * 2;
return std::make_shared<CMultiLineLabel>(rect, font, alignment, color, text);
}