(Font) Added spaceAdvance SizeInfo
Former-commit-id: 2767915c2554103615918347c6e742cb324092c5
This commit is contained in:
parent
1781e93462
commit
9d83f3f474
|
|
@ -98,6 +98,7 @@ class NAZARA_API NzFont : public NzResource, NzAbstractAtlas::Listener, NzNonCop
|
||||||
|
|
||||||
struct SizeInfo
|
struct SizeInfo
|
||||||
{
|
{
|
||||||
|
int spaceAdvance;
|
||||||
unsigned int lineHeight;
|
unsigned int lineHeight;
|
||||||
float underlinePosition;
|
float underlinePosition;
|
||||||
float underlineThickness;
|
float underlineThickness;
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,15 @@ const NzFont::SizeInfo& NzFont::GetSizeInfo(unsigned int characterSize) const
|
||||||
sizeInfo.underlinePosition = m_data->QueryUnderlinePosition(characterSize);
|
sizeInfo.underlinePosition = m_data->QueryUnderlinePosition(characterSize);
|
||||||
sizeInfo.underlineThickness = m_data->QueryUnderlineThickness(characterSize);
|
sizeInfo.underlineThickness = m_data->QueryUnderlineThickness(characterSize);
|
||||||
|
|
||||||
|
NzFontGlyph glyph;
|
||||||
|
if (m_data->ExtractGlyph(characterSize, ' ', nzTextStyle_None, &glyph))
|
||||||
|
sizeInfo.spaceAdvance = glyph.advance;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NazaraWarning("Failed to extract space character from font, using half the size");
|
||||||
|
sizeInfo.spaceAdvance = characterSize/2;
|
||||||
|
}
|
||||||
|
|
||||||
it = m_sizeInfoCache.insert(std::make_pair(characterSize, sizeInfo)).first;
|
it = m_sizeInfoCache.insert(std::make_pair(characterSize, sizeInfo)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue