finish up ranges, other minor fixes

This commit is contained in:
Glenn Maynard
2003-01-16 20:21:07 +00:00
parent a222aa7e75
commit 3ec2605b60
6 changed files with 119 additions and 106 deletions
-58
View File
@@ -19,9 +19,6 @@
#include "RageException.h"
#include "RageTimer.h"
FontManager::aliasmap FontManager::CharAliases;
map<CString,CString> FontManager::CharAliasRepl;
FontManager* FONT = NULL;
FontManager::FontManager()
@@ -68,8 +65,6 @@ void FontManager::ReloadFonts()
Font* FontManager::LoadFont( const CString &sFontOrTextureFilePath, CString sChars )
{
InitCharAliases();
// Convert the path to lowercase so that we don't load duplicates.
// Really, this does not solve the duplicate problem. We could have two copies
// of the same bitmap if there are equivalent but different paths
@@ -116,56 +111,3 @@ void FontManager::UnloadFont( Font *fp )
RageException::Throw( "Unloaded an unknown font (%p)", fp );
}
void FontManager::InitCharAliases()
{
if(!CharAliases.empty())
return;
/* XXX; these should be in a data file somewhere (theme metrics?)
* (The comments here are UTF-8; they won't show up in VC6.) */
CharAliases["default"] = Font::DEFAULT_GLYPH; /* ? */
CharAliases["kakumei1"] = 0x9769; /* 革 */
CharAliases["kakumei2"] = 0x547D; /* 命 */
CharAliases["matsuri"] = 0x796D; /* 祭 */
CharAliases["oni"] = 0x9B3C; /* 鬼 */
CharAliases["michi"] = 0x9053; /* 道 */
CharAliases["futatsu"] = 0x5F10; /* 弐 */
CharAliases["omega"] = 0x03a9; /* Ω */
CharAliases["whiteheart"] = 0x2661; /* ♡ */
CharAliases["blackstar"] = 0x2605; /* ★ */
CharAliases["whitestar"] = 0x2606; /* ☆ */
CharAliases["flipped-a"] = 0x2200; /* ∀ */
/* These are internal-use glyphs; they don't have real Unicode codepoints. */
CharAliases["up"] = 0xE000;
CharAliases["down"] = 0xE001;
CharAliases["left"] = 0xE002;
CharAliases["right"] = 0xE003;
CharAliases["menuup"] = 0xE004;
CharAliases["menudown"] = 0xE005;
CharAliases["menuleft"] = 0xE006;
CharAliases["menuright"] = 0xE007;
CharAliases["start"] = 0xE008;
CharAliases["invalid"] = INVALID_CHAR; /* 0xFFFF */
for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i)
{
CString from = ssprintf("&%s;", i->first.GetString());
CString to = LcharToUTF8(i->second);
from.MakeUpper();
CharAliasRepl[from] = to;
LOG->Trace("from '%s' to '%s'", from.GetString(), to.GetString());
}
}
/* Replace all &markers; and &#NNNN;s with UTF-8. I'm not really
* sure where to put this; this is used elsewhere, too. */
void FontManager::ReplaceMarkers( CString &sText )
{
InitCharAliases();
ReplaceText(sText, FontManager::CharAliasRepl);
Replace_Unicode_Markers(sText);
}