From f0fec34dc9c2dbc86dd424e4963983cbb2ed9b41 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 21 Jun 2023 22:29:40 +1000 Subject: The Fontpocalypse I hate it --- source/windowing/StarLabelWidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/windowing/StarLabelWidget.cpp') 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(); } -- cgit v1.2.3