auto-assign internal glyphs; remove comment (bothered to fix? first I've

even heard of it ...)
This commit is contained in:
Glenn Maynard
2006-12-05 22:57:53 +00:00
parent 0f95d7be97
commit bc4a3034f3
+37 -32
View File
@@ -29,10 +29,6 @@ static map<RString,RString> CharAliasRepl;
* text to disk, we need to write placeholders (&doublezeta;) for them, and never * text to disk, we need to write placeholders (&doublezeta;) for them, and never
* Unicode characters, since the codepoint is prone to change. We can't currently * Unicode characters, since the codepoint is prone to change. We can't currently
* write &these; to SMs, due to format limitations. * write &these; to SMs, due to format limitations.
*
* Internal use glyphs should ONLY go in the section marked "internal use", or there
* will be hard-to-debug conflicts like the "doublezeta" vs. "back" conflict that
* no one bothered to fix for several months.
*/ */
/* Here's a copy-and-paste for a basic Japanese font page: /* Here's a copy-and-paste for a basic Japanese font page:
@@ -77,6 +73,8 @@ static void InitCharAliases()
/* The comments here are UTF-8; they won't show up in VC6 (use your /* The comments here are UTF-8; they won't show up in VC6 (use your
* imagination). */ * imagination). */
#define INTERNAL 0xE000
/* Hiragana: */ /* Hiragana: */
struct alias { struct alias {
const char *str; const char *str;
@@ -289,40 +287,47 @@ static void InitCharAliases()
{ "sharp", 0x266F }, /* ♯ */ { "sharp", 0x266F }, /* ♯ */
/* These are internal-use glyphs; they don't have real Unicode codepoints. */ /* These are internal-use glyphs; they don't have real Unicode codepoints. */
{ "up", 0xE000 }, { "up", INTERNAL },
{ "down", 0xE001 }, { "down", INTERNAL },
{ "left", 0xE002 }, { "left", INTERNAL },
{ "right", 0xE003 }, { "right", INTERNAL },
{ "menuup", 0xE004 }, { "menuup", INTERNAL },
{ "menudown", 0xE005 }, { "menudown", INTERNAL },
{ "menuleft", 0xE006 }, { "menuleft", INTERNAL },
{ "menuright", 0xE007 }, { "menuright", INTERNAL },
{ "start", 0xE008 }, { "start", INTERNAL },
{ "doublezeta", 0xE009 }, { "doublezeta", INTERNAL },
{ "planet", 0xE00A }, { "planet", INTERNAL },
{ "back", 0xE009 }, { "back", INTERNAL },
{ "ok", 0xE00A }, { "ok", INTERNAL },
{ "nextrow", 0xE00B }, { "nextrow", INTERNAL },
{ "select", 0xE00C }, { "select", INTERNAL },
/* PlayStation-style controller */ /* PlayStation-style controller */
{ "auxx", 0xE010 }, { "auxx", INTERNAL },
{ "auxtriangle",0xE011 }, { "auxtriangle",INTERNAL },
{ "auxsquare", 0xE012 }, { "auxsquare", INTERNAL },
{ "auxcircle", 0xE013 }, { "auxcircle", INTERNAL },
{ "auxl1", 0xE014 }, { "auxl1", INTERNAL },
{ "auxl2", 0xE015 }, { "auxl2", INTERNAL },
{ "auxl3", 0xE016 }, { "auxl3", INTERNAL },
{ "auxr1", 0xE017 }, { "auxr1", INTERNAL },
{ "auxr2", 0xE018 }, { "auxr2", INTERNAL },
{ "auxr3", 0xE019 }, { "auxr3", INTERNAL },
{ "auxselect", 0xE01A }, { "auxselect", INTERNAL },
{ "auxstart", 0xE01B }, { "auxstart", INTERNAL },
{ NULL, 0 } { NULL, 0 }
}; };
int iNextInternalUseCodepoint = 0xE000;
for( unsigned n = 0; aliases[n].str; ++n ) for( unsigned n = 0; aliases[n].str; ++n )
CharAliases[aliases[n].str] = aliases[n].chr; {
int iCodepoint = aliases[n].chr;
if( iCodepoint == INTERNAL )
iCodepoint = iNextInternalUseCodepoint++;
CharAliases[aliases[n].str] = iCodepoint;
}
for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i) for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i)
{ {