reapplied lost Russian letters fix from revision 4877

-Fixed some problems with russian letters in IMP page (by ViSoR)
-Added 2 letters for French (Ligatures Æ, æ, Œ, œ). Now we have support for all French alphabet
-Converted French text to UTF-8 for simple use in ather OS Language

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5489 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2012-08-21 10:31:12 +00:00
parent 82bfc8d9f4
commit 3136327c5a
2 changed files with 101 additions and 31 deletions
+77 -9
View File
@@ -114,6 +114,9 @@ void RenderGender( void );
void DecrementTextEnterMode( void ); void DecrementTextEnterMode( void );
void Print8CharacterOnlyString( void ); void Print8CharacterOnlyString( void );
BOOLEAN CheckCharacterInputForEgg( void ); BOOLEAN CheckCharacterInputForEgg( void );
UINT32 GetCyrillicUnicodeChar( UINT32 uiKey );
UINT32 TranslateKey( UINT32 uiKey, unsigned char* translationTable );
BOOLEAN CheckIsKeyValid( UINT32 uiKey );
// mouse region callbacks // mouse region callbacks
void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason ); void SelectFullNameRegionCallBack(MOUSE_REGION * pRegion, INT32 iReason );
@@ -572,18 +575,29 @@ void HandleBeginScreenTextEvent( UINT32 uiKey )
break; break;
default: default:
//Heinz (18.01.2009): Russian layout //Heinz (18.01.2009): Russian layout
// ViSoR (07.01.2012) : Russian and Belarussian layouts
// //
#if defined(RUSSIAN) #if defined(RUSSIAN) || defined(BELARUSSIAN)
if( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x419) if( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x419) // Russian
{ {
unsigned char RussianTranslationTable[] = unsigned char TranslationTable[] =
" #Ý####ý####á-þ.0123456789ÆæÁ#Þ##ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨"; " #Ý####ý####á-þ.0123456789ÆæÁ#Þ##ÔÈÑÂÓÀÏÐØÎËÄÜÒÙÇÉÊÛÅÃÌÖ×Íßõ#ú#_¸ôèñâóàïðøîëäüòùçéêûåãìö÷íÿÕ#Ú¨";
if(uiKey >= ' ' && uiKey <= '~') uiKey = RussianTranslationTable[uiKey-' '];
else uiKey = '#'; uiKey = TranslateKey( uiKey, TranslationTable );
uiKey = GetCyrillicUnicodeChar( uiKey );
} }
else if( !(uiKey >= 'A' && uiKey <= 'Z' || uiKey >= 'a' && uiKey <= 'z' || uiKey >= '0' && uiKey <= '9' || else if ( ( (DWORD)GetKeyboardLayout(0) & 0xFFFF ) == 0x423) // Belarussian
uiKey == '_' || uiKey == '.' || uiKey == ' ') ) uiKey = '#'; {
if(uiKey != '#') unsigned char TranslationTable[] =
" #Ý####ý####á-þ.0123456789ÆæÁ#Þ##Ô²ÑÂÓÀÏÐØÎËÄÜÒ¡ÇÉÊÛÅÃÌÖ×Íßõ#'#_¸ô³ñâóàïðøîëäüò¢çéêûåãìö÷íÿÕ#'¨";
uiKey = TranslateKey( uiKey, TranslationTable );
uiKey = GetCyrillicUnicodeChar( uiKey );
}
else if( !CheckIsKeyValid( uiKey ) )
uiKey = '#';
if( uiKey != '#')
#else #else
#ifndef USE_CODE_PAGE #ifndef USE_CODE_PAGE
if( uiKey >= 'A' && uiKey <= 'Z' || if( uiKey >= 'A' && uiKey <= 'Z' ||
@@ -674,7 +688,61 @@ void HandleBeginScreenTextEvent( UINT32 uiKey )
return; return;
} }
UINT32 GetCyrillicUnicodeChar( UINT32 uiKey )
{
// À - ÿ
if (uiKey >= 192 && uiKey <= 255)
uiKey += 0x0350;
// ¨
if (uiKey == 168)
uiKey = 0x0401;
// ¸
if (uiKey == 184)
uiKey = 0x0451;
// ¡
if (uiKey == 161)
uiKey = 0x040E;
// ¢
if (uiKey == 162)
uiKey = 0x045E;
// ²
if (uiKey == 178)
uiKey = 0x0406;
// ³
if (uiKey == 179)
uiKey = 0x0456;
return uiKey;
}
BOOLEAN CheckIsKeyValid( UINT32 uiKey )
{
if( uiKey >= 'A' && uiKey <= 'Z' ||
uiKey >= 'a' && uiKey <= 'z' ||
uiKey >= '0' && uiKey <= '9' ||
uiKey == '_' ||
uiKey == '.' ||
uiKey == ' ')
return TRUE;
else
return FALSE;
}
UINT32 TranslateKey( UINT32 uiKey, unsigned char* translationTable )
{
if( uiKey >= ' ' && uiKey <= '~' )
uiKey = translationTable[uiKey-' '];
else
uiKey = '#';
return uiKey;
}
void DisplayFullNameStringCursor( void ) void DisplayFullNameStringCursor( void )
{ {
+24 -22
View File
@@ -724,7 +724,8 @@ INT16 GetIndex(CHAR16 siChar)
UINT16 ssCount=0; UINT16 ssCount=0;
UINT16 usNumberOfSymbols = pFManager->pTranslationTable->usNumberOfSymbols; UINT16 usNumberOfSymbols = pFManager->pTranslationTable->usNumberOfSymbols;
siChar = GetUnicodeChar(siChar); //inshy: We don't need anymore ANSI convertation to UNICODE.
//siChar = GetUnicodeChar(siChar);
// search the Translation Table and return the index for the font // search the Translation Table and return the index for the font
pTrav = pFManager->pTranslationTable->DynamicArrayOf16BitValues; pTrav = pFManager->pTranslationTable->DynamicArrayOf16BitValues;
@@ -745,7 +746,8 @@ INT16 GetIndex(CHAR16 siChar)
return 0; return 0;
} }
//inshy: We don't need anymore ANSI convertation to UNICODE.
/*
CHAR16 GetUnicodeChar(CHAR16 siChar) CHAR16 GetUnicodeChar(CHAR16 siChar)
{ {
#ifdef GERMAN #ifdef GERMAN
@@ -918,7 +920,7 @@ CHAR16 GetUnicodeChar(CHAR16 siChar)
//case 236: siChar = 236; break; //i' //case 236: siChar = 236; break; //i'
//case 210: siChar = 210; break; //O' //case 210: siChar = 210; break; //O'
//case 242: siChar = 242; break; //o' //case 242: siChar = 242; break; //o'
//inshy: I've added the character codes for French ligatures to the sources, but I haven't added them in the fonts! //inshy: French ligatures
//Ligature //Ligature
//case 198: siChar = 198; break; //Æ //case 198: siChar = 198; break; //Æ
//case 140: siChar = 338; break; //Œ //case 140: siChar = 338; break; //Œ
@@ -930,6 +932,7 @@ CHAR16 GetUnicodeChar(CHAR16 siChar)
return siChar; return siChar;
} }
*/
//***************************************************************************** //*****************************************************************************
// SetFont // SetFont
@@ -1969,23 +1972,23 @@ FontTranslationTable *CreateEnglishTransTable( )
temp++; temp++;
// POLISH letters in UNICODE // POLISH letters in UNICODE
*temp = 260; // ¥ (îí) *temp = 260; // ¥ (on)
temp++; temp++;
*temp = 262; // Æ (öå) *temp = 262; // Æ (tse)
temp++; temp++;
*temp = 280; // Ê (ýí) *temp = 280; // Ê (en')
temp++; temp++;
*temp = 321; // £ (ýëü) *temp = 321; // £ (el')
temp++; temp++;
*temp = 323; // Ñ (ýíü) *temp = 323; // Ñ (en)
temp++; temp++;
*temp = 211; // Ó (î êðàòêîå) *temp = 211; // Ó (o kratkoe)
temp++; temp++;
*temp = 346; // Œ (ýñü) *temp = 346; // Œ (es')
temp++; temp++;
*temp = 379; // ¯ (æåò) *temp = 379; // ¯ (zhet)
temp++; temp++;
*temp = 377; // (çåò) *temp = 377; // (zet)
temp++; temp++;
*temp = 261; // ¹ (îí) *temp = 261; // ¹ (îí)
temp++; temp++;
@@ -2070,16 +2073,15 @@ FontTranslationTable *CreateEnglishTransTable( )
*temp = 242; //o' *temp = 242; //o'
temp++; temp++;
//inshy: I've added the character codes for French ligatures to the sources, but I haven't added them in the fonts! //French ligatures
//Ligature *temp = 198; //Æ
// *temp = 198; //Æ temp++;
// temp++; *temp = 338; //Œ
// *temp = 338; //Œ temp++;
// temp++; *temp = 230; //æ
// *temp = 230; //æ temp++;
// temp++; *temp = 339; //œ
// *temp = 339; //œ temp++;
// temp++;
// Font glyphs for spell targeting icons // Font glyphs for spell targeting icons