mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
TOON: Support hebrew characters and bidi text
This commit is contained in:
parent
b5fa1e3efd
commit
02b3d3651a
@ -97,6 +97,17 @@ static const ADGameDescription gameDescriptions[] = {
|
||||
},
|
||||
Common::RU_RUS, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GUIO_NOMIDI)
|
||||
},
|
||||
{
|
||||
"toon", "",
|
||||
{
|
||||
{"toonfont.caf", 0, "28f3210c901c86cd585d69eda3a2fd37", 30364},
|
||||
{"local.pak", 0, "3290209ef9bc92692108dd2f45df0736", 3237611},
|
||||
{"arcaddbl.svl", 0, "c418478cd2833c7c983799f948af41ac", 7844688},
|
||||
{"study.svl", 0, "281efa3f33f6712c0f641a605f4d40fd", 2511090},
|
||||
AD_LISTEND
|
||||
},
|
||||
Common::HE_ISR, Common::kPlatformDOS, ADGF_NO_FLAGS, GUIO1(GUIO_NOMIDI)
|
||||
},
|
||||
{
|
||||
"toon", "Demo",
|
||||
{
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/unicode-bidi.h"
|
||||
|
||||
#include "toon/font.h"
|
||||
|
||||
@ -53,6 +54,17 @@ static const byte map_textToFont[0x80] = {
|
||||
0x23, 0x08, 0x23, 0x06, 0x15, 0x23, 0x1b, 0x23, 0x23, 0x16, 0x07, 0x17, 0x1c, 0x23, 0x23, 0x23 // 0xFx
|
||||
};
|
||||
|
||||
static const byte hebrew_map_textToFont[0x80] = {
|
||||
'?', '?', '?', '?', 0x03, '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', // 0x8x
|
||||
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', // 0x9x
|
||||
'?', 0x09, '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', // 0xAx
|
||||
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', 0x0a, // 0xBx
|
||||
'?', '?', '?', '?', 0x1d, '?', '?', 0x02, '?', '?', '?', '?', '?', '?', '?', '?', // 0xCx
|
||||
'?', 0x0b, '?', '?', '?', '?', 0x1e, '?', '?', '?', '?', 0x20, 0x1f, '?', '?', 0x19, // 0xDx
|
||||
0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, // 0xEx
|
||||
0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x17, 0x1c, 0x23, 0x23, 0x23 // 0xFx
|
||||
};
|
||||
|
||||
byte FontRenderer::textToFont(byte c) {
|
||||
// No need to remap simple characters.
|
||||
if (c < 0x80)
|
||||
@ -65,6 +77,9 @@ byte FontRenderer::textToFont(byte c) {
|
||||
if (_vm->_language == Common::ES_ESP && c == 0xe9)
|
||||
return 0x10;
|
||||
|
||||
if (_vm->_language == Common::HE_ISR)
|
||||
return hebrew_map_textToFont[c - 0x80];
|
||||
|
||||
// Use the common map to convert the extended characters.
|
||||
return map_textToFont[c - 0x80];
|
||||
}
|
||||
@ -92,6 +107,10 @@ void FontRenderer::renderText(int16 x, int16 y, const Common::String &origText,
|
||||
int32 height = 0;
|
||||
|
||||
const byte *text = (const byte *)origText.c_str();
|
||||
|
||||
if (_vm->_language == Common::HE_ISR)
|
||||
text = (const byte *)Common::convertBiDiString((const char *) text, Common::kWindows1255).c_str();
|
||||
|
||||
while (*text) {
|
||||
byte curChar = *text;
|
||||
if (curChar == 13) {
|
||||
@ -301,6 +320,10 @@ void FontRenderer::renderMultiLineText(int16 x, int16 y, const Common::String &o
|
||||
|
||||
for (int32 i = 0; i < numLines; i++) {
|
||||
const byte *line = lines[i];
|
||||
|
||||
if (_vm->_language == Common::HE_ISR)
|
||||
line = (const byte *)Common::convertBiDiString((const char *) line, Common::kWindows1255).c_str();
|
||||
|
||||
curX = x - lineSize[i] / 2;
|
||||
_vm->addDirtyRect(curX + _vm->state()->_currentScrollValue, curY, curX + lineSize[i] + _vm->state()->_currentScrollValue + 2, curY + height);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user