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:
+3
-15
@@ -270,16 +270,10 @@ void Font::MergeFont(Font &f)
|
|||||||
|
|
||||||
const glyph &Font::GetGlyph( wchar_t c ) const
|
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. */
|
/* If that's missing, use the default glyph. */
|
||||||
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(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(DEFAULT_GLYPH);
|
if(it == m_iCharToGlyph.end()) it = m_iCharToGlyph.find(DEFAULT_GLYPH);
|
||||||
|
|
||||||
if(it == m_iCharToGlyph.end())
|
if(it == m_iCharToGlyph.end())
|
||||||
@@ -543,13 +537,7 @@ void Font::LoadFontPageSettings(FontPageSettings &cfg, IniFile &ini, const CStri
|
|||||||
continue;
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
void FontManager::ReloadFonts()
|
||||||
{
|
{
|
||||||
for(map<FontName, Font*>::iterator i = g_mapPathToFont.begin();
|
for(map<FontName, Font*>::iterator i = g_mapPathToFont.begin();
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ public:
|
|||||||
* that'll get freed eventually and crash. This is only used for realtime
|
* that'll get freed eventually and crash. This is only used for realtime
|
||||||
* adjustment of fonts in ScreenTestFonts at the moment. */
|
* adjustment of fonts in ScreenTestFonts at the moment. */
|
||||||
void ReloadFonts();
|
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
|
extern FontManager* FONT; // global and accessable from anywhere in our program
|
||||||
|
|||||||
Reference in New Issue
Block a user