use glyph and width of '0' for ' ' in number fonts (a leading zero)

This commit is contained in:
Chris Danford
2008-08-17 10:05:16 +00:00
parent 811bc374e1
commit 422add5110
3 changed files with 23 additions and 11 deletions
@@ -281,7 +281,7 @@ void TextureFont::FormatFontPage( int iPage, HDC hDC )
/* First, generate bitmaps for all characters in this page. */
for( unsigned i = 0; i < Desc.chars.size(); ++i )
FormatCharacter( Desc.chars[i], hDC );
FormatCharacter( Desc.chars[i].glyphAndWidth, hDC );
FontPage *pPage = m_apPages[iPage];
pPage->m_iFrameWidth = (m_BoundingRect.right - m_BoundingRect.left) + m_iPadding;
@@ -302,7 +302,7 @@ void TextureFont::FormatFontPage( int iPage, HDC hDC )
int iRow = 0, iCol = 0;
for( unsigned CurChar = 0; CurChar < Desc.chars.size(); ++CurChar )
{
const wchar_t c = Desc.chars[CurChar];
const wchar_t c = Desc.chars[CurChar].glyphAndWidth;
const ABC &abc = m_ABC[c];
/* The current frame is at fOffsetX/fOffsetY. Center the character
@@ -418,7 +418,7 @@ void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension,
f << setw(1);
for( int iX = 0; iX < page.m_iNumFramesX && iChar < desc.chars.size(); ++iX, ++iChar )
{
const wchar_t c = desc.chars[iChar];
const wchar_t c = desc.chars[iChar].codepoint;
string sUTF8;
wchar_to_utf8( c, sUTF8 );
f << sUTF8.c_str();
@@ -433,7 +433,7 @@ void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension,
{
/* This is the total width to advance for the whole character, which is the
* sum of the ABC widths. */
const wchar_t c = desc.chars[j];
const wchar_t c = desc.chars[j].glyphAndWidth;
ABC &abc = m_ABC[c];
int iCharWidth = abc.abcA + int(abc.abcB) + int(abc.abcC);
f << j << "=" << iCharWidth << "\n";