Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/windowing/StarLabelWidget.cpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-06-21 22:29:40 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-06-21 22:29:40 +1000
commitf0fec34dc9c2dbc86dd424e4963983cbb2ed9b41 (patch)
tree9073336184d32365b861df91b2fc062c39e0fb15 /source/windowing/StarLabelWidget.cpp
parent865f9a328a9068c9917c52c387f27b3e102712bc (diff)
The Fontpocalypse
I hate it
Diffstat (limited to 'source/windowing/StarLabelWidget.cpp')
-rw-r--r--source/windowing/StarLabelWidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/windowing/StarLabelWidget.cpp b/source/windowing/StarLabelWidget.cpp
index 5159704..cfc273c 100644
--- a/source/windowing/StarLabelWidget.cpp
+++ b/source/windowing/StarLabelWidget.cpp
@@ -19,6 +19,7 @@ LabelWidget::LabelWidget(String text,
auto fontConfig = assets->json("/interface.config:font");
m_fontSize = fontConfig.getInt("baseSize");
m_processingDirectives = fontConfig.getString("defaultDirectives");
+ m_font = fontConfig.queryString("defaultFont", "");
setText(move(text));
}
@@ -79,6 +80,7 @@ RectI LabelWidget::getScissorRect() const {
}
void LabelWidget::renderImpl() {
+ context()->setFont(m_font);
context()->setFontSize(m_fontSize);
context()->setFontColor(m_color.toRgba());
context()->setFontProcessingDirectives(m_processingDirectives);
@@ -90,6 +92,7 @@ void LabelWidget::renderImpl() {
context()->renderInterfaceText(m_text, {Vec2F(screenPosition()), m_hAnchor, m_vAnchor, m_wrapWidth, m_textCharLimit});
+ context()->setDefaultFont();
context()->setFontProcessingDirectives("");
context()->setDefaultLineSpacing();
}
@@ -98,7 +101,7 @@ void LabelWidget::updateTextRegion() {
context()->setFontSize(m_fontSize);
context()->setFontColor(m_color.toRgba());
context()->setFontProcessingDirectives(m_processingDirectives);
-
+ context()->setFont(m_font);
if (m_lineSpacing)
context()->setLineSpacing(*m_lineSpacing);
else
@@ -107,6 +110,7 @@ void LabelWidget::updateTextRegion() {
m_textRegion = RectI(context()->determineInterfaceTextSize(m_text, {Vec2F(), m_hAnchor, m_vAnchor, m_wrapWidth, m_textCharLimit}));
setSize(m_textRegion.size());
+ context()->setDefaultFont();
context()->setFontProcessingDirectives("");
context()->setDefaultLineSpacing();
}