Remove game-specific glyphs. It adds overhead to setting every BitmapText,

and nothing uses it.  If we want to do this, add Lua conditionals to font
pages.
This commit is contained in:
Glenn Maynard
2004-09-27 13:33:08 +00:00
parent 9ae79be7da
commit 3c997641f8
3 changed files with 4 additions and 40 deletions
+4 -16
View File
@@ -270,16 +270,10 @@ void Font::MergeFont(Font &f)
const glyph &Font::GetGlyph( wchar_t c ) const
{
ASSERT(c >= 0 && c <= 0xFFFFFF);
/* Try the regular character. */
map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(c);
/* See if there's a game-specific version of this character. */
int gc = FontManager::MakeGameGlyph(c, GAMESTATE->m_pCurGame);
map<longchar,glyph*>::const_iterator it = m_iCharToGlyph.find(gc);
/* If there isn't, try the regular character. */
if(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(c);
/* If *that's* missing, use the default glyph. */
/* If that's missing, use the default glyph. */
if(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(DEFAULT_GLYPH);
if(it == m_iCharToGlyph.end())
@@ -543,13 +537,7 @@ void Font::LoadFontPageSettings(FontPageSettings &cfg, IniFile &ini, const CStri
continue;
}
if(pGame != NULL)
{
longchar lc = FontManager::MakeGameGlyph(c, pGame);
cfg.CharToGlyphNo[lc] = atoi(data);
} else {
cfg.CharToGlyphNo[c] = atoi(data);
}
cfg.CharToGlyphNo[c] = atoi(data);
continue;
}
-21
View File
@@ -29,27 +29,6 @@ FontManager::~FontManager()
}
}
/* A longchar is at least 32 bits. If c & 0xFF000000, it's a game-custom
* character; game 0 is 0x0100nnnn, game 1 is 0x0200nnnn, and so on. */
longchar FontManager::MakeGameGlyph(wchar_t c, const Game* g)
{
ASSERT(c >= 0 && c <= 0xFFFF);
int index = GAMEMAN->GetIndexFromGame(g);
ASSERT(index >= 0 && index <= 0xFF);
return longchar (((index+1) << 24) + c);
}
bool FontManager::ExtractGameGlyph(longchar ch, wchar_t &cOut, const Game *&gOut)
{
if((ch & 0xFF000000) == 0) return false; /* not a game glyph */
int index = (ch >> 24) - 1;
gOut = GAMEMAN->GetGameFromIndex( index );
cOut = wchar_t(ch & 0xFFFF);
return true;
}
void FontManager::ReloadFonts()
{
for(map<FontName, Font*>::iterator i = g_mapPathToFont.begin();
-3
View File
@@ -23,9 +23,6 @@ public:
* that'll get freed eventually and crash. This is only used for realtime
* adjustment of fonts in ScreenTestFonts at the moment. */
void ReloadFonts();
static longchar MakeGameGlyph(wchar_t c, const Game* g);
static bool ExtractGameGlyph(longchar ch, wchar_t &c, const Game*& g);
};
extern FontManager* FONT; // global and accessable from anywhere in our program