add bad char support

This commit is contained in:
Glenn Maynard
2003-01-06 04:23:41 +00:00
parent a0f664ad35
commit de0f656d27
3 changed files with 9 additions and 1 deletions
+2
View File
@@ -415,6 +415,8 @@ Font* FontManager::LoadFont( const CString &sFontOrTextureFilePath, CString sCha
CharAliases["menuright"] = 0x100007;
CharAliases["start"] = 0x100008;
CharAliases["invalid"] = INVALID_CHAR; /* 0xFFFFFF */
for(aliasmap::const_iterator i = CharAliases.begin(); i != CharAliases.end(); ++i)
{
CString from = ssprintf("&%s;", i->first.GetString());
+6 -1
View File
@@ -903,6 +903,8 @@ longchar utf8_get_char (const char *p)
return result;
}
const longchar INVALID_CHAR = 0xFFFFFF;
lstring CStringToLstring(const CString &str)
{
const char *ptr = str.c_str(), *end = str.c_str()+str.size();
@@ -912,7 +914,10 @@ lstring CStringToLstring(const CString &str)
while(ptr && ptr != end)
{
longchar c = utf8_get_char (ptr);
ret.push_back(c);
if(c == -1)
ret.push_back(INVALID_CHAR);
else
ret.push_back(c);
ptr = utf8_find_next_char (ptr, end);
}
+1
View File
@@ -153,6 +153,7 @@ void splitrelpath(
* be 16-bit. This is mostly used within the font and text system. */
typedef int longchar;
typedef basic_string<longchar> lstring;
extern const longchar INVALID_CHAR;
lstring CStringToLstring(const CString &str);
CString LcharToUTF8( longchar c );