forked from enlightenment/efl
parent
6c7831c3ab
commit
554dccdb0b
|
@ -223,11 +223,13 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
|||
/* grrr - this means font face sharing is kinda... not an option if */
|
||||
/* you want performance */
|
||||
if ((use_kerning) && (prev_index) && (index) &&
|
||||
(pface == fi->src->ft.face)) {
|
||||
(pface == fi->src->ft.face))
|
||||
{
|
||||
#ifdef INTERNATIONAL_SUPPORT
|
||||
/* if it's rtl, the kerning matching should be reversed, i.e prev
|
||||
* index is now the index and the other way around. */
|
||||
if (evas_intl_is_rtl_char(level_list, char_index)) {
|
||||
if (evas_intl_is_rtl_char(level_list, char_index))
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
||||
pen_x += kern;
|
||||
}
|
||||
|
@ -388,7 +390,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
|||
prev_index = index;
|
||||
}
|
||||
#ifdef INTERNATIONAL_SUPPORT
|
||||
if (bidi_err >= 0) {
|
||||
if (bidi_err >= 0)
|
||||
{
|
||||
free(level_list);
|
||||
free(text);
|
||||
}
|
||||
|
|
|
@ -122,20 +122,19 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
|||
|
||||
len = _evas_intl_arabic_text_to_isolated(text);
|
||||
/*FIXME: make it skip vowels */
|
||||
for (i = 0 ; i < len ; i++) {
|
||||
|
||||
if (! ARABIC_IS_LETTER(text[i])) {
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if (!ARABIC_IS_LETTER(text[i]))
|
||||
{
|
||||
/* mark so it won't be touched,
|
||||
* though start formating */
|
||||
if (last_letter && !start_of_context) {
|
||||
if (last_letter && !start_of_context)
|
||||
{
|
||||
ArabicContext tmp = (last_is_first) ?
|
||||
ARABIC_CONTEXT_ISOLATED
|
||||
:
|
||||
ARABIC_CONTEXT_FINAL;
|
||||
ARABIC_CONTEXT_ISOLATED : ARABIC_CONTEXT_FINAL;
|
||||
text[i-1] = _evas_intl_arabic_isolated_to_context(
|
||||
last_letter,
|
||||
tmp);
|
||||
|
||||
}
|
||||
last_is_first = 0;
|
||||
start_of_context = 1;
|
||||
|
@ -144,7 +143,8 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
|||
}
|
||||
/* adjust the last letter */
|
||||
last_letter = text[i];
|
||||
if (ARABIC_IS_SPECIAL_LETTER(text[i])) {
|
||||
if (ARABIC_IS_SPECIAL_LETTER(text[i]))
|
||||
{
|
||||
if (!start_of_context)
|
||||
text[i] = _evas_intl_arabic_isolated_to_context(text[i], ARABIC_CONTEXT_FINAL);
|
||||
/* else: leave isolated */
|
||||
|
@ -154,11 +154,13 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (start_of_context) {
|
||||
if (start_of_context)
|
||||
{
|
||||
text[i] = _evas_intl_arabic_isolated_to_context(text[i], ARABIC_CONTEXT_INITIAL);
|
||||
last_is_first = 1;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
text[i] = _evas_intl_arabic_isolated_to_context(text[i], ARABIC_CONTEXT_MEDIAL);
|
||||
last_is_first = 0;
|
||||
}
|
||||
|
@ -168,12 +170,11 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
|||
}
|
||||
/* if it's arabic and not isolated, the last is always final */
|
||||
i--;
|
||||
if (last_letter && !start_of_context) {
|
||||
if (last_letter && !start_of_context)
|
||||
{
|
||||
ArabicContext tmp = (last_is_first) ? ARABIC_CONTEXT_ISOLATED : ARABIC_CONTEXT_FINAL;
|
||||
/* because it's medial atm, and should be isolated */
|
||||
text[i] = _evas_intl_arabic_isolated_to_context(
|
||||
last_letter,
|
||||
tmp);
|
||||
text[i] = _evas_intl_arabic_isolated_to_context(last_letter, tmp);
|
||||
}
|
||||
|
||||
return len;
|
||||
|
@ -184,7 +185,8 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
|||
static FriBidiChar
|
||||
_evas_intl_arabic_general_to_isolated(FriBidiChar chr)
|
||||
{
|
||||
switch (chr) {
|
||||
switch (chr)
|
||||
{
|
||||
case ARABIC_ALEPH_MADDA:
|
||||
return ARABIC_ISOLATED_ALEPH_MADDA;
|
||||
|
||||
|
@ -193,6 +195,7 @@ _evas_intl_arabic_general_to_isolated(FriBidiChar chr)
|
|||
|
||||
case ARABIC_TA_MARBUTA:
|
||||
return ARABIC_ISOLATED_TA_MARBUTA;
|
||||
|
||||
case ARABIC_BET:
|
||||
return ARABIC_ISOLATED_BET;
|
||||
|
||||
|
@ -284,14 +287,16 @@ _evas_intl_arabic_general_to_isolated(FriBidiChar chr)
|
|||
static FriBidiChar
|
||||
_evas_intl_arabic_isolated_to_context(FriBidiChar chr, ArabicContext context)
|
||||
{
|
||||
if (ARABIC_IS_SPECIAL_LETTER(chr)) {
|
||||
if (ARABIC_IS_SPECIAL_LETTER(chr))
|
||||
{
|
||||
if (context == ARABIC_CONTEXT_INITIAL)
|
||||
return chr;
|
||||
else
|
||||
return chr + ARABIC_CONTEXT_FINAL;
|
||||
}
|
||||
/* HACK AROUND ALIF MAQSURA */
|
||||
else if (chr == ARABIC_ISOLATED_ALEPH_MAQSURA && context > 1) {
|
||||
else if (chr == ARABIC_ISOLATED_ALEPH_MAQSURA && context > 1)
|
||||
{
|
||||
chr = 0xFBE8; /* the initial form */
|
||||
context -= 2;
|
||||
}
|
||||
|
@ -302,7 +307,8 @@ static int
|
|||
_evas_intl_arabic_text_to_isolated(FriBidiChar *text)
|
||||
{
|
||||
int i = 0;
|
||||
while (*text) {
|
||||
while (*text)
|
||||
{
|
||||
/* if it's not arabic/it's already in context
|
||||
* it's just returned the same */
|
||||
*text = _evas_intl_arabic_general_to_isolated(*text);
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
/* FIXME: fribidi_utf8_to_unicode should use char len and not byte len!*/
|
||||
char *
|
||||
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction,
|
||||
FriBidiLevel **embedding_level_list)
|
||||
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction, FriBidiLevel **embedding_level_list)
|
||||
{
|
||||
FriBidiChar *unicode_in, *unicode_out;
|
||||
char *text_out;
|
||||
|
@ -29,7 +28,8 @@ evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direct
|
|||
|
||||
/* if there's nothing to do, return text
|
||||
* one char draws are quite common */
|
||||
if (len <= 1) {
|
||||
if (len <= 1)
|
||||
{
|
||||
*ret_len = len;
|
||||
*embedding_level_list = NULL;
|
||||
return strdup(text);
|
||||
|
@ -38,26 +38,26 @@ evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direct
|
|||
byte_len = strlen(text); /* we need the actual number of bytes, not number of chars */
|
||||
|
||||
unicode_in = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
||||
if (!unicode_in) {
|
||||
if (!unicode_in)
|
||||
{
|
||||
len = -1;
|
||||
goto error1;
|
||||
|
||||
}
|
||||
|
||||
len = fribidi_utf8_to_unicode(text, byte_len, unicode_in);
|
||||
|
||||
unicode_out = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
||||
if (!unicode_out) {
|
||||
if (!unicode_out)
|
||||
{
|
||||
len = -2;
|
||||
goto error2;
|
||||
|
||||
}
|
||||
|
||||
*embedding_level_list = (FriBidiLevel *)malloc(sizeof(FriBidiLevel) * len);
|
||||
if (!*embedding_level_list) {
|
||||
if (!*embedding_level_list)
|
||||
{
|
||||
len = -3;
|
||||
goto error3;
|
||||
|
||||
}
|
||||
|
||||
#ifdef ARABIC_SUPPORT
|
||||
|
@ -65,14 +65,15 @@ evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direct
|
|||
evas_intl_arabic_to_context(unicode_in);
|
||||
#endif
|
||||
if (!fribidi_log2vis(unicode_in, len, direction,
|
||||
unicode_out, NULL, NULL, *embedding_level_list)) {
|
||||
unicode_out, NULL, NULL, *embedding_level_list))
|
||||
{
|
||||
len = -4;
|
||||
goto error3;
|
||||
|
||||
}
|
||||
|
||||
text_out = malloc(UTF8_BYTES_PER_CHAR * len + 1);
|
||||
if (!text_out) {
|
||||
if (!text_out)
|
||||
{
|
||||
len = -5;
|
||||
goto error4;
|
||||
}
|
||||
|
@ -98,7 +99,6 @@ error1:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
evas_intl_is_rtl_char(FriBidiLevel *embedded_level_list, FriBidiStrIndex i)
|
||||
{
|
||||
|
|
|
@ -22,8 +22,7 @@ int
|
|||
evas_intl_is_rtl_char(FriBidiLevel *embedded_level_list, FriBidiStrIndex i);
|
||||
|
||||
char *
|
||||
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction,
|
||||
FriBidiLevel **embedding_level_list);
|
||||
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction, FriBidiLevel **embedding_level_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue