Fix font issues

it's 1:30 AM again :(
This commit is contained in:
Kae 2023-06-25 01:34:29 +10:00
parent cb76e4e444
commit 7783fc7310
3 changed files with 8 additions and 2 deletions

View File

@ -274,13 +274,13 @@ void Chat::renderImpl() {
m_chatLog->drawImage(m_portraitBackground, Vec2F(imagePosition), 1.0f, fade); m_chatLog->drawImage(m_portraitBackground, Vec2F(imagePosition), 1.0f, fade);
m_chatLog->drawImage(message.portrait, Vec2F(imagePosition + m_portraitImageOffset), m_portraitScale, fade); m_chatLog->drawImage(message.portrait, Vec2F(imagePosition + m_portraitImageOffset), m_portraitScale, fade);
tp.pos += Vec2F(0, floor(messageHeight / 2)); tp.pos += Vec2F(0, floor(messageHeight / 2));
m_chatLog->drawText(messageString, tp, m_fontSize, fade, FontMode::Normal, m_chatLineHeight, m_fontDirectives); m_chatLog->drawText(messageString, tp, m_fontSize, fade, FontMode::Normal, m_chatLineHeight, m_font, m_fontDirectives);
} else { } else {
TextPositioning tp = {Vec2F(chatMin), HorizontalAnchor::LeftAnchor, VerticalAnchor::BottomAnchor, wrapWidth}; TextPositioning tp = {Vec2F(chatMin), HorizontalAnchor::LeftAnchor, VerticalAnchor::BottomAnchor, wrapWidth};
messageHeight = guiContext.determineInterfaceTextSize(messageString, tp).size()[1] + lineHeightMargin; messageHeight = guiContext.determineInterfaceTextSize(messageString, tp).size()[1] + lineHeightMargin;
m_chatLog->drawText(messageString, tp, m_fontSize, fade, FontMode::Normal, m_chatLineHeight, m_fontDirectives); m_chatLog->drawText(messageString, tp, m_fontSize, fade, FontMode::Normal, m_chatLineHeight, m_font, m_fontDirectives);
} }
chatMin[1] += ceil(messageHeight); chatMin[1] += ceil(messageHeight);

View File

@ -197,6 +197,7 @@ void ChatBubbleManager::addChatActions(List<ChatAction> chatActions, bool silent
// yea I agree // yea I agree
m_guiContext->setFontSize(m_fontSize, m_zoom); m_guiContext->setFontSize(m_fontSize, m_zoom);
m_guiContext->setFontProcessingDirectives("");
m_guiContext->setDefaultFont(); m_guiContext->setDefaultFont();
auto result = m_guiContext->determineTextSize(sayAction.text, m_textTemplate); auto result = m_guiContext->determineTextSize(sayAction.text, m_textTemplate);
float textWidth = result.width() / m_zoom + m_textPadding[0]; float textWidth = result.width() / m_zoom + m_textPadding[0];
@ -334,6 +335,8 @@ void ChatBubbleManager::drawBubbleText(Vec2F screenPos, BubbleText const& bubble
// use the alpha as a blend value for the text colour as pulled from data. // use the alpha as a blend value for the text colour as pulled from data.
Vec4B const& displayColor = Vec4B(baseColor[0], baseColor[1], baseColor[2], (baseColor[3] * alpha) / 255); Vec4B const& displayColor = Vec4B(baseColor[0], baseColor[1], baseColor[2], (baseColor[3] * alpha) / 255);
m_guiContext->setDefaultFont();
m_guiContext->setFontProcessingDirectives("");
m_guiContext->setFontColor(displayColor); m_guiContext->setFontColor(displayColor);
m_guiContext->setFontSize(get<1>(bubbleText), m_zoom); m_guiContext->setFontSize(get<1>(bubbleText), m_zoom);

View File

@ -102,6 +102,9 @@ void NameplatePainter::render() {
context.renderText(*nametag.statusText, statusPosition(bubble.currentPosition)); context.renderText(*nametag.statusText, statusPosition(bubble.currentPosition));
} }
context.setDefaultFont();
context.setFontProcessingDirectives("");
}); });
} }