mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Fixed uninitialized max glyph size in Font.
This commit is contained in:
parent
7c31d7ca0a
commit
030c840cfb
|
@ -197,6 +197,8 @@ Font::Font(int size, const std::string& path) : mSize(size), mPath(path)
|
|||
{
|
||||
assert(mSize > 0);
|
||||
|
||||
mMaxGlyphHeight = 0;
|
||||
|
||||
if(!sLibrary)
|
||||
initLibrary();
|
||||
|
||||
|
@ -588,7 +590,9 @@ Eigen::Vector2f Font::sizeText(std::string text, float lineSpacing)
|
|||
y += lineHeight;
|
||||
}
|
||||
|
||||
lineWidth += getGlyph(character)->advance.x();
|
||||
Glyph* glyph = getGlyph(character);
|
||||
if(glyph)
|
||||
lineWidth += glyph->advance.x();
|
||||
}
|
||||
|
||||
if(lineWidth > highestWidth)
|
||||
|
@ -605,6 +609,7 @@ float Font::getHeight(float lineSpacing) const
|
|||
float Font::getLetterHeight()
|
||||
{
|
||||
Glyph* glyph = getGlyph((UnicodeChar)'S');
|
||||
assert(glyph);
|
||||
return glyph->texSize.y() * glyph->texture->textureSize.y();
|
||||
}
|
||||
|
||||
|
@ -689,7 +694,9 @@ Eigen::Vector2f Font::getWrappedTextCursorOffset(std::string text, float xLen, s
|
|||
continue;
|
||||
}
|
||||
|
||||
lineWidth += getGlyph(character)->advance.x();
|
||||
Glyph* glyph = glyph;
|
||||
if(glyph)
|
||||
lineWidth += glyph->advance.x();
|
||||
}
|
||||
|
||||
return Eigen::Vector2f(lineWidth, y);
|
||||
|
|
Loading…
Reference in a new issue