Evas font: fixed calling of bidi_end_of_run_get and exposed a new function to get the script of a single char.

SVN revision: 56483
This commit is contained in:
Tom Hacohen 2011-01-30 10:39:35 +00:00
parent 7ce45d8bd4
commit f7a4cf52a8
2 changed files with 9 additions and 7 deletions

View File

@ -36,8 +36,8 @@ evas_common_language_unicode_funcs_get(void)
return NULL; return NULL;
} }
static Evas_Script_Type Evas_Script_Type
_get_script(Eina_Unicode unicode) evas_common_language_char_script_get(Eina_Unicode unicode)
{ {
#ifdef USE_HARFBUZZ #ifdef USE_HARFBUZZ
static hb_unicode_funcs_t *funcs; static hb_unicode_funcs_t *funcs;
@ -62,7 +62,7 @@ evas_common_language_script_end_of_run_get(const Eina_Unicode *str,
for (i = 0 ; i < len ; i++, str++) for (i = 0 ; i < len ; i++, str++)
{ {
Evas_Script_Type tmp; Evas_Script_Type tmp;
tmp = _get_script(*str); tmp = evas_common_language_char_script_get(*str);
/* Arabic is the first script in the array that's not /* Arabic is the first script in the array that's not
* common/inherited. */ * common/inherited. */
if ((first == EVAS_SCRIPT_UNKNOWN) && (tmp >= EVAS_SCRIPT_ARABIC)) if ((first == EVAS_SCRIPT_UNKNOWN) && (tmp >= EVAS_SCRIPT_ARABIC))
@ -78,8 +78,7 @@ evas_common_language_script_end_of_run_get(const Eina_Unicode *str,
#ifdef BIDI_SUPPORT #ifdef BIDI_SUPPORT
{ {
int bidi_end; int bidi_end;
bidi_end = evas_bidi_end_of_run_get(bidi_props, start, bidi_end = evas_bidi_end_of_run_get(bidi_props, start, len);
start + len);
if (bidi_end > 0) if (bidi_end > 0)
{ {
i = (i < bidi_end) ? i : bidi_end; i = (i < bidi_end) ? i : bidi_end;
@ -94,7 +93,7 @@ evas_common_language_script_end_of_run_get(const Eina_Unicode *str,
else else
{ {
#ifdef BIDI_SUPPORT #ifdef BIDI_SUPPORT
return evas_bidi_end_of_run_get(bidi_props, start, start + len); return evas_bidi_end_of_run_get(bidi_props, start, len);
#endif #endif
} }
return 0; return 0;
@ -105,7 +104,7 @@ evas_common_language_script_type_get(const Eina_Unicode *str)
{ {
Evas_Script_Type script = EVAS_SCRIPT_COMMON; Evas_Script_Type script = EVAS_SCRIPT_COMMON;
/* Arabic is the first script in the array that's not a common/inherited */ /* Arabic is the first script in the array that's not a common/inherited */
for ( ; *str && ((script = _get_script(*str)) < EVAS_SCRIPT_ARABIC) ; str++) for ( ; *str && ((script = evas_common_language_char_script_get(*str)) < EVAS_SCRIPT_ARABIC) ; str++)
; ;
return script; return script;
} }

View File

@ -119,6 +119,9 @@ evas_common_language_script_end_of_run_get(const Eina_Unicode *str, const Evas_B
Evas_Script_Type Evas_Script_Type
evas_common_language_script_type_get(const Eina_Unicode *str); evas_common_language_script_type_get(const Eina_Unicode *str);
Evas_Script_Type
evas_common_language_char_script_get(Eina_Unicode unicode);
const char * const char *
evas_common_language_from_locale_get(void); evas_common_language_from_locale_get(void);