Fix glyph width issue with custom fonts

haha woopsies!!
This commit is contained in:
Kae 2023-06-21 20:40:40 +10:00
parent 320428eddf
commit 865f9a328a

View File

@ -388,6 +388,7 @@ RectF TextPainter::doRenderLine(String const& s, TextPositioning const& position
RectF TextPainter::doRenderGlyph(String::Char c, TextPositioning const& position, bool reallyRender) { RectF TextPainter::doRenderGlyph(String::Char c, TextPositioning const& position, bool reallyRender) {
if (m_nonRenderedCharacters.find(String(c)) != NPos) if (m_nonRenderedCharacters.find(String(c)) != NPos)
return RectF(); return RectF();
setFont(m_renderSettings.font);
int width = glyphWidth(c); int width = glyphWidth(c);
// Offset left by width if right anchored. // Offset left by width if right anchored.
float hOffset = 0; float hOffset = 0;
@ -403,7 +404,6 @@ RectF TextPainter::doRenderGlyph(String::Char c, TextPositioning const& position
vOffset = -(float)m_fontSize; vOffset = -(float)m_fontSize;
if (reallyRender) { if (reallyRender) {
setFont(m_renderSettings.font);
if ((int)m_renderSettings.mode & (int)FontMode::Shadow) { if ((int)m_renderSettings.mode & (int)FontMode::Shadow) {
Color shadow = Color::Black; Color shadow = Color::Black;
uint8_t alphaU = m_renderSettings.color[3]; uint8_t alphaU = m_renderSettings.color[3];