From 99044bdb9c1f66594a5bc91d1886f991029811e3 Mon Sep 17 00:00:00 2001 From: tasn Date: Sun, 30 Jan 2011 10:35:37 +0000 Subject: [PATCH] Evas font-engine: Moved bidi utils (and added script utils) to a subdir language that collects all the language specific adjustments to font handling. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@56446 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/canvas/evas_object_textblock.c | 6 +++- src/lib/engines/common/Makefile.am | 6 ++-- src/lib/engines/common/evas_font.h | 2 +- src/lib/engines/common/evas_font_draw.c | 2 +- src/lib/engines/common/evas_font_query.c | 2 +- src/lib/engines/common/evas_pipe.h | 2 +- .../common/{ => language}/evas_bidi_utils.c | 0 .../common/{ => language}/evas_bidi_utils.h | 2 +- .../engines/common/language/evas_script_utils.c | 40 ++++++++++++++++++++++ .../engines/common/language/evas_script_utils.h | 11 ++++++ src/lib/include/evas_common.h | 2 +- src/lib/include/evas_private.h | 3 +- 12 files changed, 68 insertions(+), 10 deletions(-) rename src/lib/engines/common/{ => language}/evas_bidi_utils.c (100%) rename src/lib/engines/common/{ => language}/evas_bidi_utils.h (100%) create mode 100644 src/lib/engines/common/language/evas_script_utils.c create mode 100644 src/lib/engines/common/language/evas_script_utils.h diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 6558b18..6c196bc 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -2477,9 +2477,13 @@ _layout_text_add_and_split_item(Ctxt *c, Evas_Object_Textblock_Format *fmt, do { Evas_Object_Textblock_Text_Item *new_ti; + /* FIXME: We assume here that it's ok to have an empty item with + * no text nodes, make sure it's the case. */ if (ti->parent.text_node) { - cutoff = evas_bidi_end_of_run_get(ti->parent.text_node->bidi_props, + cutoff = evas_common_script_end_of_run_get( + eina_ustrbuf_string_get(ti->parent.text_node->unicode), + ti->parent.text_node->bidi_props, ti->parent.text_pos, len); if (cutoff > 0) { diff --git a/src/lib/engines/common/Makefile.am b/src/lib/engines/common/Makefile.am index 00fbb06..170f5fb 100644 --- a/src/lib/engines/common/Makefile.am +++ b/src/lib/engines/common/Makefile.am @@ -59,7 +59,8 @@ evas_scale_span.c \ evas_tiler.c \ evas_regionbuf.c \ evas_pipe.c \ -evas_bidi_utils.c \ +language/evas_bidi_utils.c \ +language/evas_script_utils.c \ evas_map_image.c \ evas_map_image.h @@ -98,7 +99,8 @@ evas_scale_smooth_scaler_noscale.c \ evas_scale_smooth_scaler_up.c \ evas_scale_span.h \ evas_pipe.h \ -evas_bidi_utils.h \ +language/evas_bidi_utils.h \ +language/evas_script_utils.h \ evas_map_image_internal.c \ evas_map_image_core.c \ evas_map_image_loop.c diff --git a/src/lib/engines/common/evas_font.h b/src/lib/engines/common/evas_font.h index 5dd93e1..b96f437 100644 --- a/src/lib/engines/common/evas_font.h +++ b/src/lib/engines/common/evas_font.h @@ -1,6 +1,6 @@ #ifndef _EVAS_FONT_H #define _EVAS_FONT_H -#include "evas_bidi_utils.h" +#include "language/evas_bidi_utils.h" /* main */ diff --git a/src/lib/engines/common/evas_font_draw.c b/src/lib/engines/common/evas_font_draw.c index d02c26f..23e92ad 100644 --- a/src/lib/engines/common/evas_font_draw.c +++ b/src/lib/engines/common/evas_font_draw.c @@ -2,7 +2,7 @@ #include "evas_private.h" #include "evas_blend_private.h" -#include "evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */ +#include "language/evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */ #include "evas_font_private.h" /* for Frame-Queuing support */ #define WORD_CACHE_MAXLEN 50 diff --git a/src/lib/engines/common/evas_font_query.c b/src/lib/engines/common/evas_font_query.c index b707474..8d80673 100644 --- a/src/lib/engines/common/evas_font_query.c +++ b/src/lib/engines/common/evas_font_query.c @@ -1,5 +1,5 @@ #include "evas_common.h" -#include "evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */ +#include "language/evas_bidi_utils.h" /*defines BIDI_SUPPORT if possible */ #include "evas_font_private.h" /* for Frame-Queuing support */ EAPI int diff --git a/src/lib/engines/common/evas_pipe.h b/src/lib/engines/common/evas_pipe.h index e658e1f..5ee8eed 100644 --- a/src/lib/engines/common/evas_pipe.h +++ b/src/lib/engines/common/evas_pipe.h @@ -1,6 +1,6 @@ #ifndef _EVAS_PIPE_H #define _EVAS_PIPE_H -#include "evas_bidi_utils.h" +#include "language/evas_bidi_utils.h" #ifdef BUILD_PTHREAD typedef struct _Thinfo diff --git a/src/lib/engines/common/evas_bidi_utils.c b/src/lib/engines/common/language/evas_bidi_utils.c similarity index 100% rename from src/lib/engines/common/evas_bidi_utils.c rename to src/lib/engines/common/language/evas_bidi_utils.c diff --git a/src/lib/engines/common/evas_bidi_utils.h b/src/lib/engines/common/language/evas_bidi_utils.h similarity index 100% rename from src/lib/engines/common/evas_bidi_utils.h rename to src/lib/engines/common/language/evas_bidi_utils.h index ac89799..37266c6 100644 --- a/src/lib/engines/common/evas_bidi_utils.h +++ b/src/lib/engines/common/language/evas_bidi_utils.h @@ -26,7 +26,6 @@ #endif #include -#include "evas_common.h" #ifdef USE_FRIBIDI # include @@ -75,6 +74,7 @@ struct _Evas_BiDi_Paragraph_Props { #endif }; +#include "evas_common.h" struct _Evas_BiDi_Props { Evas_BiDi_Direction dir; }; diff --git a/src/lib/engines/common/language/evas_script_utils.c b/src/lib/engines/common/language/evas_script_utils.c new file mode 100644 index 0000000..a5711ac --- /dev/null +++ b/src/lib/engines/common/language/evas_script_utils.c @@ -0,0 +1,40 @@ +/** + * @internal + * @addtogroup Evas_Utils + * + * @{ + */ +/** + * @internal + * @defgroup Evas_Script Evas Script (language) utility functions + * + * This set of functions and types helps evas handle scripts correctly. + * @todo Document types, structures and macros. + * + * @{ + */ +#include + +#include "evas_script_utils.h" +#include "evas_bidi_utils.h" /* Used for fallback. */ +int +evas_common_script_end_of_run_get(const Eina_Unicode *str, + const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, int len) +{ + /* FIXME: Currently we fall back to bidi runs, should fix */ + (void) str; +#ifdef BIDI_SUPPORT + return evas_bidi_end_of_run_get(bidi_props, start, len); +#else + (void) bidi_props; + return 0; +#endif +} + +/* + * @} + */ +/* + * @} + */ + diff --git a/src/lib/engines/common/language/evas_script_utils.h b/src/lib/engines/common/language/evas_script_utils.h new file mode 100644 index 0000000..4ee70bf --- /dev/null +++ b/src/lib/engines/common/language/evas_script_utils.h @@ -0,0 +1,11 @@ +#ifndef _EVAS_SCRIPT_UTILS +#define _EVAS_SCRIPT_UTILS + +#include +#include "evas_bidi_utils.h" + +int +evas_common_script_end_of_run_get(const Eina_Unicode *str, const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, int len); + +#endif + diff --git a/src/lib/include/evas_common.h b/src/lib/include/evas_common.h index bd9b44f..fa15f5a 100644 --- a/src/lib/include/evas_common.h +++ b/src/lib/include/evas_common.h @@ -688,7 +688,7 @@ struct _RGBA_Draw_Context #ifdef BUILD_PIPE_RENDER #include "../engines/common/evas_map_image.h" -#include "../engines/common/evas_bidi_utils.h" +#include "../engines/common/language/evas_bidi_utils.h" struct _RGBA_Pipe_Op { diff --git a/src/lib/include/evas_private.h b/src/lib/include/evas_private.h index 6b839a2..c81ca8f 100644 --- a/src/lib/include/evas_private.h +++ b/src/lib/include/evas_private.h @@ -11,7 +11,8 @@ #include "../file/evas_module.h" #include "../file/evas_path.h" -#include "../engines/common/evas_bidi_utils.h" +#include "../engines/common/language/evas_bidi_utils.h" +#include "../engines/common/language/evas_script_utils.h" #ifdef EVAS_MAGIC_DEBUG /* complain when peole pass in wrong object types etc. */ -- 2.7.4