Fix a bug with fribidi
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5567 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2275ecaa2b
commit
be70408b38
@ -181,58 +181,58 @@ const wchar_t* Translations::w_gettext(const char* original)
|
|||||||
|
|
||||||
|
|
||||||
#if ENABLE_BIDI
|
#if ENABLE_BIDI
|
||||||
|
if(this->isRTLLanguage())
|
||||||
const int FRIBIDI_BUFFER_SIZE = 512;
|
|
||||||
FriBidiChar fribidiInput[FRIBIDI_BUFFER_SIZE];
|
|
||||||
|
|
||||||
int len = 0;
|
|
||||||
int n = 0;
|
|
||||||
//std::cout << "fribidi input : ";
|
|
||||||
for (n = 0; ; n++)
|
|
||||||
{
|
{
|
||||||
fribidiInput[n] = out_ptr[n];
|
const int FRIBIDI_BUFFER_SIZE = 512;
|
||||||
//std::cout << (int)fribidiInput[n] << " ";
|
FriBidiChar fribidiInput[FRIBIDI_BUFFER_SIZE];
|
||||||
len++;
|
|
||||||
|
|
||||||
if (n == FRIBIDI_BUFFER_SIZE-1) // prevent buffeoverflows
|
int len = 0;
|
||||||
|
int n = 0;
|
||||||
|
//std::cout << "fribidi input : ";
|
||||||
|
for (n = 0; ; n++)
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING : translated stirng too long, truncating!\n";
|
fribidiInput[n] = out_ptr[n];
|
||||||
fribidiInput[n] = 0;
|
//std::cout << (int)fribidiInput[n] << " ";
|
||||||
break;
|
len++;
|
||||||
|
|
||||||
|
if (n == FRIBIDI_BUFFER_SIZE-1) // prevent buffeoverflows
|
||||||
|
{
|
||||||
|
std::cerr << "WARNING : translated string too long, truncating!\n";
|
||||||
|
fribidiInput[n] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (fribidiInput[n] == 0) break; // stop on '\0'
|
||||||
}
|
}
|
||||||
if (fribidiInput[n] == 0) break; // stop on '\0'
|
//std::cout << " (len=" << len << ")\n";
|
||||||
}
|
|
||||||
//std::cout << " (len=" << len << ")\n";
|
|
||||||
|
|
||||||
FriBidiCharType pbase_dir = FRIBIDI_TYPE_ON; //FIXME: what's that?
|
FriBidiCharType pbase_dir = FRIBIDI_TYPE_ON; //FIXME: what's that?
|
||||||
|
|
||||||
static FriBidiChar fribidiOutput[FRIBIDI_BUFFER_SIZE];
|
static FriBidiChar fribidiOutput[FRIBIDI_BUFFER_SIZE];
|
||||||
|
|
||||||
fribidi_boolean result = fribidi_log2vis(fribidiInput,
|
fribidi_boolean result = fribidi_log2vis(fribidiInput,
|
||||||
len-1,
|
len-1,
|
||||||
&pbase_dir,
|
&pbase_dir,
|
||||||
fribidiOutput,
|
fribidiOutput,
|
||||||
/* gint *position_L_to_V_list */ NULL,
|
/* gint *position_L_to_V_list */ NULL,
|
||||||
/* gint *position_V_to_L_list */ NULL,
|
/* gint *position_V_to_L_list */ NULL,
|
||||||
/* gint8 *embedding_level_list */ NULL
|
/* gint8 *embedding_level_list */ NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
std::cerr << "Fribidi failed in 'fribidi_log2vis' =(\n";
|
std::cerr << "Fribidi failed in 'fribidi_log2vis' =(\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::cout << "fribidi output : ";
|
//std::cout << "fribidi output : ";
|
||||||
//for (FriBidiChar* c=fribidiOutput; *c != 0; c++)
|
//for (FriBidiChar* c=fribidiOutput; *c != 0; c++)
|
||||||
//{
|
//{
|
||||||
// std::cout << (int)fribidiOutput[n] << " ";
|
// std::cout << (int)fribidiOutput[n] << " ";
|
||||||
//}
|
//}
|
||||||
//std::cout << "\n";
|
//std::cout << "\n";
|
||||||
|
|
||||||
|
|
||||||
return (const wchar_t*)fribidiOutput;
|
return (const wchar_t*)fribidiOutput;
|
||||||
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
return out_ptr;
|
return out_ptr;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user