From d0a95bc1d148da2731e68a218546d836eb2db2ba Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 17 Aug 2008 14:31:14 +0000 Subject: [PATCH] remove hack for leading 0s in numbers --- .../Texture Font GeneratorDlg.cpp | 11 +++-------- stepmania/src/Texture Font Generator/TextureFont.cpp | 10 +++++----- stepmania/src/Texture Font Generator/TextureFont.h | 8 +------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp b/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp index 21729f241a..50ebde2797 100644 --- a/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp +++ b/stepmania/src/Texture Font Generator/Texture Font GeneratorDlg.cpp @@ -153,9 +153,8 @@ void CTextureFontGeneratorDlg::UpdateFont( bool bSavingDoubleRes ) for( int i = 0; map_cp1252[i]; ++i ) { wchar_t wc = map_cp1252[i]; - FontPageDescription::Char c = { wc, wc }; if( wc != 0xFFFF ) - desc.chars.push_back(c); + desc.chars.push_back(wc); } g_pTextureFont->m_PagesToGenerate.push_back( desc ); @@ -164,9 +163,8 @@ void CTextureFontGeneratorDlg::UpdateFont( bool bSavingDoubleRes ) for( int i = 0; map_iso_8859_2[i]; ++i ) { wchar_t wc = map_iso_8859_2[i]; - FontPageDescription::Char c = { wc, wc }; if( wc != 0xFFFF ) - desc.chars.push_back(c); + desc.chars.push_back(wc); } g_pTextureFont->m_PagesToGenerate.push_back( desc ); } @@ -177,11 +175,8 @@ void CTextureFontGeneratorDlg::UpdateFont( bool bSavingDoubleRes ) for( int i = 0; map_numbers[i]; ++i ) { wchar_t wc = map_numbers[i]; - FontPageDescription::Char c = { wc, wc }; - if( wc == 0x0020 ) // space - c.glyphAndWidth = 0x0030; // '0' if( wc != 0xFFFF ) - desc.chars.push_back(c); + desc.chars.push_back(wc); } g_pTextureFont->m_PagesToGenerate.push_back( desc ); } diff --git a/stepmania/src/Texture Font Generator/TextureFont.cpp b/stepmania/src/Texture Font Generator/TextureFont.cpp index af6f1f528e..2537f1b325 100644 --- a/stepmania/src/Texture Font Generator/TextureFont.cpp +++ b/stepmania/src/Texture Font Generator/TextureFont.cpp @@ -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].glyphAndWidth, hDC ); + FormatCharacter( Desc.chars[i], 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].glyphAndWidth; + const wchar_t c = Desc.chars[CurChar]; const ABC &abc = m_ABC[c]; /* The current frame is at fOffsetX/fOffsetY. Center the character @@ -423,7 +423,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].codepoint; + const wchar_t c = desc.chars[iChar]; string sUTF8; wchar_to_utf8( c, sUTF8 ); f << sUTF8.c_str(); @@ -443,7 +443,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].glyphAndWidth; + const wchar_t c = desc.chars[j]; ABC &abc = m_ABC[c]; int iCharWidth = abc.abcA + int(abc.abcB) + int(abc.abcC); viCharWidth.push_back( iCharWidth ); @@ -453,7 +453,7 @@ void TextureFont::Save( CString sBasePath, CString sBitmapAppendBeforeExtension, } for( unsigned j = 0; j < desc.chars.size(); ++j ) { - const wchar_t c = desc.chars[j].glyphAndWidth; + const wchar_t c = desc.chars[j]; int iCharWidth = viCharWidth[j]; if( desc.name == "numbers" && IsNumberChar( c ) ) iCharWidth = iMaxNumberCharWidth; diff --git a/stepmania/src/Texture Font Generator/TextureFont.h b/stepmania/src/Texture Font Generator/TextureFont.h index a86d515183..1b5c28d0a1 100644 --- a/stepmania/src/Texture Font Generator/TextureFont.h +++ b/stepmania/src/Texture Font Generator/TextureFont.h @@ -8,13 +8,7 @@ using namespace std; struct FontPageDescription { CString name; - struct Char - { - // Glyph and code point may differ. For example, we may want to render ' ' as '0' in a numbers font to achieve a leading '0' character that can be styled differently from regular '0'. - wchar_t glyphAndWidth; - wchar_t codepoint; - }; - vector chars; + vector chars; }; struct FontPage