summaryrefslogtreecommitdiff
path: root/src/gui/gui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/gui.cpp')
-rw-r--r--src/gui/gui.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 68f43cc3..ae74cab2 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -106,6 +106,9 @@ Gui::Gui(Graphics *graphics)
std::string fontFile = branding.getValue("font", "fonts/dejavusans.ttf");
std::string path = resman->getPath(fontFile);
+ // Initialize the font scale before creating the fonts
+ TrueTypeFont::updateFontScale(graphics->getScale());
+
try
{
mGuiFont = new TrueTypeFont(path, fontSize);
@@ -222,17 +225,20 @@ void Gui::draw()
mGraphics->_endDraw();
}
-void Gui::videoResized(int width, int height)
+bool Gui::videoResized(int width, int height)
{
+ TrueTypeFont::updateFontScale(static_cast<Graphics*>(mGraphics)->getScale());
+
auto *top = static_cast<WindowContainer*>(getTop());
int oldWidth = top->getWidth();
int oldHeight = top->getHeight();
if (oldWidth == width && oldHeight == height)
- return;
+ return false;
top->setSize(width, height);
top->adjustAfterResize(oldWidth, oldHeight);
+ return true;
}
void Gui::setUseCustomCursor(bool customCursor)