📄 fontinfo.cpp
字号:
} if (CHARSET__iso_8859_5 == ulCharset || CHARSET__koi8_r == ulCharset) { HX_ASSERT(0 && "handle_MacCyrillic(Ukranian?)_charset"); }#else // /What do you see when an infant eats food for the first time?: const UINT8 ucFirstHighChar = FIRST_UPPER_128_CHAR_INDEX; if(CHARSET__x_mac_roman == ulCharset) { //WINDOWS and UNIX need conversion, if mac-roman charset, to the // iso-8859-1 charset: while (*pBuf) { if ((UINT8)(*pBuf) >= ucFirstHighChar) { _CHAR tmpCh = macRoman_to_iso88591[ (UINT8)(*pBuf) - ucFirstHighChar]; //Translate only if there is a matching character: if (UNKNOWN_CHAR_CONVERSION != tmpCh && UNDEFINED_CHAR_CONVERSION != tmpCh) { *pBuf = tmpCh; } } pBuf++; }; goto cleanup; } if (uiMaxSupportedLevel < 1) // /RealText 1.0 is level 0 only. { goto cleanup; } if (CHARSET__us_ascii == ulCharset) { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /None of these chars are defined, so do what browsers do // and ignore the high-order bit: *pBuf &= 0x7F; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_1 == ulCharset) // /Western European { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_1_INDEX) { ; // /They're all OK; WinLatin1 maps to iso-8859-1 } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-9 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_2 == ulCharset) // /Eastern European { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if ((UINT8)(*pBuf) >= FIRST_UPPER_ISO_8859_2_INDEX) { // /Note: I manually made these translations by comparing the // codepages -eh: if (0xA0 == uCh || (uCh >= 0xA2 && uCh <= 0xA4) || 0xA7 == uCh || 0xA8 == uCh || 0xAA == uCh || 0xAD == uCh || (uCh >= 0xAF && uCh <= 0xB0) || (uCh >= 0xB2 && uCh <= 0xB4) || 0xB8 == uCh || 0xBA == uCh || (uCh >= 0xC0 && uCh <= 0xFF) ) { ; // /It's OK as is. } else if (0xA1 == uCh) { *pBuf = (_CHAR)0xA5; } else if (0xA5 == uCh) { *pBuf = (_CHAR)0xBC; } else if (0xA6 == uCh || 0xB6 == uCh) { *pBuf -= 0x1A; // /A6->8C, B6->9C } else if (0xA9 == uCh || 0xAE == uCh || 0xB9 == uCh) { *pBuf -= 0x1F; // /A9->8A, AE->8E, B9->9A } else if (0xAB == uCh || 0xBB == uCh) { *pBuf -= 0x1E; // /AB->8D, BB->9D } else if (0xAC == uCh || 0xBC == uCh) { *pBuf -= 0x1D; // /AC->8F, BC->9F } else if (0xB1 == uCh) { *pBuf = (_CHAR)0xB9; } else if (0xB5 == uCh) { *pBuf = (_CHAR)0xBE; } else if (0xB7 == uCh) { *pBuf = (_CHAR)0xA1; } else if (0xBD == uCh) { *pBuf = (_CHAR)0x94; } else if (0xBE == uCh || 0xBF == uCh) { *pBuf -= 0x20; // /BE->9E, BF->9F } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-5 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_5 == ulCharset) // /Cyrillic { while (*pBuf) { if ((UINT8)(*pBuf) >= FIRST_UPPER_ISO_8859_5_INDEX) { // /Note: I manually made these translations by comparing the // codepages -eh: if ((UINT8)(*pBuf) < 0xB0) { *pBuf = (_CHAR)iso88595_to_windows1251_A0_to_AF[ (UINT8)(*pBuf) - 0xA0]; } else if ((UINT8)(*pBuf) >= 0xF0) { *pBuf = (_CHAR)iso88595_to_windows1251_F0_to_FF[ (UINT8)(*pBuf) - 0xF0]; } else // /add 0x10 to convert the middle 4 rows: { *pBuf += 0x10; } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-5 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__koi8_r == ulCharset) // /Cyrillic { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if ((UINT8)(*pBuf) >= ucFirstHighChar) { // /Note: I manually made these translations by comparing the // codepages -eh: if (uCh >= 0xE0) { *pBuf = (_CHAR)koi8r_to_windows1251_E0_to_FF[ uCh - 0xE0]; } else if (uCh >= 0xC0) // /and we know it is < 0xE0 { *pBuf = (_CHAR)koi8r_to_windows1251_E0_to_FF[ uCh - 0xC0 /*-0xC0==(0x20-0xE0) */] + KOI8_R_LOWER_CASE_CHAR_OFFSET; } else if (0x9A == uCh) { *pBuf = (_CHAR)0xA0;// /XXXEH- should be non-breaking space } else if (0x9C == uCh) { *pBuf = (_CHAR)0xB0; } else if (0x9E == uCh) { *pBuf = (_CHAR)0xB7; } else if (0xA3 == uCh) { *pBuf = (_CHAR)0xB8; } else if (0xB3 == uCh) { *pBuf = (_CHAR)0xA8; } else if (0xBF == uCh) { *pBuf = (_CHAR)0xA9; } else if (0x95 == uCh) { ; // /It's stays the same. } else // /All the others are from the original IBM Personal // Computer with the code page CP437's box-drawing // characters. We *could* bother to convert them (and // draw each in US-ASCII charset), but won't go to that // trouble unless we get complaints which I *strongly* // doubt will happen. Instead, just draw them as blanks: { *pBuf = (_CHAR)0x98; // /0x98 in Windows-1251 is a box } } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_6 == ulCharset) // /Arabic {#if defined(RTL_PERFORM_REVERSAL_OF_RTL_CHARS) // /First, this is Arabic, so we need to reverse the text of each line: _CHAR* pTmpBuf = pBuf; _CHAR* pNewline = pTmpBuf; while (*pTmpBuf && *pNewline) { while (*pNewline && '\r' != *pNewline && '\n' != *pNewline) { pNewline++; }; _CHAR* pFromLastChar = pNewline-1; while (*pTmpBuf && pTmpBuf < pFromLastChar) { _CHAR chTmp = *pFromLastChar; *pFromLastChar = *pTmpBuf; *pTmpBuf = chTmp; pTmpBuf++; pFromLastChar--; } if ('\r' == *pNewline && '\n' == pNewline[1]) { pNewline++; // /Treat \r\n as single char. } if (*pNewline) { pNewline++; // /Go look for the next one. } pTmpBuf = pNewline; }#endif while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_6_INDEX) { // /Note: I manually made these translations by comparing the // codepages -eh: if (0xA0 == uCh || 0xA4 == uCh || 0xAD == uCh || 0xBF == uCh || (uCh >= 0xC1 && uCh <= 0xD6)) { ; // /It's OK as is. } else if (0xAC == uCh) // /[Could also translate to 0x60 (?)] { *pBuf = (_CHAR)0x91; } else if (0xBB == uCh) { *pBuf = (_CHAR)0xBA; } else if (uCh >= 0xD7 && uCh <= 0xDA) { *pBuf += 1; } else if (uCh >= 0xE0 && uCh <= 0xE3) { *pBuf -= 4; } else if (0xE4 == uCh) { *pBuf = (_CHAR)0xE1; } else if (uCh >= 0xE5 && uCh <= 0xE8) { *pBuf -= 2; } else if (uCh >= 0xE9 && uCh <= 0xEA) { *pBuf += 3; } else if (0xEC == uCh) // /[Could also translate to 0xF1 (?)] { *pBuf = (_CHAR)0x94; } else if (0xEB == uCh || 0xED == uCh || 0xEE == uCh) { *pBuf +=5; } else if (0xEF == uCh) // /[Could also translate to 0xF5 (?)] { *pBuf = (_CHAR)0x92; } else if (0xF0 == uCh) { *pBuf +=6; } else if (0xF1 == uCh) { *pBuf +=7; } else if (0xF2 == uCh) { *pBuf += 8; } else { // /Convert chars that are not in iso-8859-6 to nbsp char: *pBuf = (_CHAR)0xA0; } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-5 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_7 == ulCharset) // /Greek { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_7_INDEX) { // /Note: I manually made these translations by comparing the // codepages -eh: if (0xA0 == uCh || 0xA3 == uCh || (uCh >= 0xA6 && uCh <= 0xA9) || (uCh >= 0xAB && uCh <= 0xAD) || (uCh >= 0xAF && uCh <= 0xB4) || (uCh >= 0xB7 && uCh <= 0xD1) || (uCh >= 0xD3 && uCh <= 0xFE) ) { ; // /It's OK as is. } else if (0xA1 == uCh || 0xA2 == uCh) { *pBuf -= 0x10; // /A1->91, A2->92 } else if (0xB5 == uCh || 0xB6 == uCh) { *pBuf -= 0x14; // /B5->A1, B6->A2. } else { // /Convert chars that are not in iso-8859-7 to nbsp char: *pBuf = (_CHAR)0xA0; } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-7 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_8 == ulCharset) // /Hebrew { // /XXXEH- NOTE: iso-8859-8's 0xDF doesn't seem to map to anything on // Windows; it appears to be a double underline char (low '='). while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_8_INDEX) { if (0xA1 == uCh || (uCh >= 0xBF && uCh <= 0xDE) || (uCh >= 0xFB && uCh <= 0xFF) ) { // /Convert chars that are not in iso-8859-8 to nbsp char: *pBuf = (_CHAR)0xA0; } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-8 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_9 == ulCharset) // /Turkish { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_9_INDEX) { ; // /All are OK as-is; WinTurkish maps exactly to iso-8859-9 } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-9 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; } else if (CHARSET__iso_ir_166 == ulCharset || // /Thai CHARSET__iso_8859_11 == ulCharset) { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_11_INDEX) { if ((uCh >= 0xDB && uCh <= 0xDE) || (uCh >= 0xFC && uCh <= 0xFF) ) { // /Convert chars that are not in iso-8859-11 to nbsp char: *pBuf = (_CHAR)0xA0; } } else if ((UINT8)(*pBuf) >= FIRST_UPPER_128_CHAR_INDEX) { // /Convert 0x80-0x9F chars that are not in iso-8859-5 to nbsp: *pBuf = (_CHAR)0xA0; } pBuf++; }; // /Caller should now be sure to handle the change in actual charset! } else if (CHARSET__iso_8859_13 == ulCharset) // /Baltic (Latin 7) { while (*pBuf) { UINT8 uCh = (UINT8)(*pBuf); if (uCh >= FIRST_UPPER_ISO_8859_13_INDEX) { if (0xA0 == uCh || (uCh >= 0xA2 && uCh <= 0xA4) || (uCh >= 0xA6 && uCh <= 0xB3) || (uCh >= 0xB5 && uCh <= 0xFF) ) { ; // /It's OK as is. } else if (0xA1 == uCh) { *pBuf = (_CHAR)0x94; } else if (0xA5 == uCh) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -