forked from enlightenment/efl
Evas: Redesigned the textblock object.
Sorry, but full documented code will be committed tomorrow, this commit is needed for the API stabilization. Major changes in this commit: 1. Changed the textblock node system there is now a linked list for the format nodes and a linked list for the text nodes. Format and text nodes point to one anoter in a matter that will be explained in the source file (will be committed tomorrow). Each text node now represents a paragraph and each format node points to a specific location in a text node. 2. Text/Format nodes are now two distinct data types. 3. The concept of nodes is no longer exposed in the API except for the format nodes which are only slightly exposed just to enable users of the API to cycle all the formats in order to find stuff like anchors. 4. Every node has a PS (paragraph separator) format node pointing to it's end, except for the last one which has nothing. Nodes are only broken by PS's. 5. Changed the BiDi functions to work nicely with offsets in big chunks of text. More is explained in the email with the subject 'Evas Textblock redesign + edje_entry adjustments' that will be sent tomorrow because of technical issues. For full documentation about this object wait for the next commit. SVN revision: 50930
This commit is contained in:
parent
2c70f0e1c9
commit
d5e579c2e9
|
@ -1313,9 +1313,10 @@ typedef void (*Evas_Object_Event_Cb) (void *data, Evas *e, Evas_Object *obj
|
|||
*
|
||||
* @ingroup Evas_Object_Specific
|
||||
*/
|
||||
typedef struct _Evas_Textblock_Style Evas_Textblock_Style;
|
||||
typedef struct _Evas_Textblock_Cursor Evas_Textblock_Cursor;
|
||||
typedef struct _Evas_Textblock_Rectangle Evas_Textblock_Rectangle;
|
||||
typedef struct _Evas_Textblock_Style Evas_Textblock_Style;
|
||||
typedef struct _Evas_Textblock_Cursor Evas_Textblock_Cursor;
|
||||
typedef struct _Evas_Object_Textblock_Node_Format Evas_Object_Textblock_Node_Format;
|
||||
typedef struct _Evas_Textblock_Rectangle Evas_Textblock_Rectangle;
|
||||
|
||||
struct _Evas_Textblock_Rectangle
|
||||
{
|
||||
|
@ -1354,35 +1355,45 @@ typedef void (*Evas_Object_Event_Cb) (void *data, Evas *e, Evas_Object *obj
|
|||
|
||||
EAPI void evas_textblock_cursor_free(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
|
||||
EAPI void evas_textblock_cursor_node_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_node_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_node_next(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_node_prev(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_paragraph_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_paragraph_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_paragraph_next(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_paragraph_prev(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI const Evas_Object_Textblock_Node_Format *evas_textblock_node_format_first_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI const Evas_Object_Textblock_Node_Format *evas_textblock_node_format_last_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EAPI const Evas_Object_Textblock_Node_Format *evas_textblock_node_format_next_get(const Evas_Object_Textblock_Node_Format *n) EINA_ARG_NONNULL(1);
|
||||
EAPI const Evas_Object_Textblock_Node_Format *evas_textblock_node_format_prev_get(const Evas_Object_Textblock_Node_Format *n) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_set_at_format(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *n) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI const Evas_Object_Textblock_Node_Format *evas_textblock_cursor_format_get(const Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI const char *evas_textblock_node_format_text_get(const Evas_Object_Textblock_Node_Format *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_at_format_set(Evas_Textblock_Cursor *cur, const Evas_Object_Textblock_Node_Format *fmt) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI Eina_Bool evas_textblock_cursor_format_is_visible_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI Eina_Bool evas_textblock_cursor_format_next(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_format_prev(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_is_format(const Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_char_next(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_char_prev(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_char_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_char_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_line_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_line_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_paragraph_char_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_paragraph_char_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_line_char_first(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_line_char_last(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI int evas_textblock_cursor_pos_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI void evas_textblock_cursor_pos_set(Evas_Textblock_Cursor *cur, int pos) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool evas_textblock_cursor_line_set(Evas_Textblock_Cursor *cur, int line) EINA_ARG_NONNULL(1);
|
||||
EAPI int evas_textblock_cursor_compare(const Evas_Textblock_Cursor *cur1, const Evas_Textblock_Cursor *cur2) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE;
|
||||
EAPI void evas_textblock_cursor_copy(const Evas_Textblock_Cursor *cur, Evas_Textblock_Cursor *cur_dest) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
EAPI void evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *text) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void evas_textblock_cursor_text_prepend(Evas_Textblock_Cursor *cur, const char *text) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI size_t evas_textblock_cursor_text_append(Evas_Textblock_Cursor *cur, const char *text) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI size_t evas_textblock_cursor_text_prepend(Evas_Textblock_Cursor *cur, const char *text) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
EAPI void evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *format) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *format) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI Eina_Bool evas_textblock_cursor_format_append(Evas_Textblock_Cursor *cur, const char *format) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI Eina_Bool evas_textblock_cursor_format_prepend(Evas_Textblock_Cursor *cur, const char *format) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void evas_textblock_cursor_node_delete(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_char_delete(Evas_Textblock_Cursor *cur) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_textblock_cursor_range_delete(Evas_Textblock_Cursor *cur1, Evas_Textblock_Cursor *cur2) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
EAPI const char *evas_textblock_cursor_node_text_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI int evas_textblock_cursor_node_text_length_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI const char *evas_textblock_cursor_node_format_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI Eina_Bool evas_textblock_cursor_node_format_is_visible_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI const char *evas_textblock_cursor_paragraph_text_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI int evas_textblock_cursor_paragraph_text_length_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI char *evas_textblock_cursor_range_text_get(const Evas_Textblock_Cursor *cur1, const Evas_Textblock_Cursor *cur2, Evas_Textblock_Text_Type format) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2) EINA_PURE;
|
||||
|
||||
EAPI int evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
||||
|
@ -1393,7 +1404,6 @@ typedef void (*Evas_Object_Event_Cb) (void *data, Evas *e, Evas_Object *obj
|
|||
EAPI Eina_Bool evas_textblock_cursor_format_item_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
||||
|
||||
EAPI Eina_Bool evas_textblock_cursor_eol_get(const Evas_Textblock_Cursor *cur) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||
EAPI void evas_textblock_cursor_eol_set(Evas_Textblock_Cursor *cur, Eina_Bool eol) EINA_ARG_NONNULL(1);
|
||||
|
||||
EAPI Eina_Bool evas_object_textblock_line_number_geometry_get(const Evas_Object *obj, int line, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
||||
EAPI void evas_object_textblock_clear(Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
|
|
|
@ -25,8 +25,9 @@ struct _Evas_Object_Text
|
|||
unsigned char r, g, b, a;
|
||||
} outline, shadow, glow, glow2;
|
||||
|
||||
unsigned char style;
|
||||
Evas_BiDi_Props intl_props;
|
||||
unsigned char style;
|
||||
Evas_BiDi_Props intl_props;
|
||||
Evas_BiDi_Paragraph_Props paragraph_bidi_props;
|
||||
} cur, prev;
|
||||
|
||||
float ascent, descent;
|
||||
|
@ -349,7 +350,7 @@ evas_object_text_text_set(Evas_Object *obj, const char *_text)
|
|||
/* DO II */
|
||||
/*Update intl_props*/
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_update_props(text, &o->cur.intl_props);
|
||||
evas_bidi_update_props(text, o->cur.intl_props.props);
|
||||
#endif
|
||||
if (o->cur.text) eina_ustringshare_del(o->cur.text);
|
||||
if (o->cur.utf8_text) eina_stringshare_del(o->cur.utf8_text);
|
||||
|
@ -1454,8 +1455,9 @@ evas_object_text_new(void)
|
|||
o = calloc(1, sizeof(Evas_Object_Text));
|
||||
o->magic = MAGIC_OBJ_TEXT;
|
||||
o->prev = o->cur;
|
||||
o->cur.intl_props.props = &o->cur.paragraph_bidi_props;
|
||||
#ifdef BIDI_SUPPORT
|
||||
o->cur.intl_props.direction = FRIBIDI_PAR_ON;
|
||||
o->cur.intl_props.props->direction = FRIBIDI_PAR_ON;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
@ -1476,8 +1478,8 @@ evas_object_text_free(Evas_Object *obj)
|
|||
if (o->cur.font) eina_stringshare_del(o->cur.font);
|
||||
if (o->cur.source) eina_stringshare_del(o->cur.source);
|
||||
if (o->engine_data) evas_font_free(obj->layer->evas, o->engine_data);
|
||||
if (o->cur.intl_props.embedding_levels) free(o->cur.intl_props.embedding_levels);
|
||||
if (o->cur.intl_props.char_types) free(o->cur.intl_props.char_types);
|
||||
if (o->cur.intl_props.props->embedding_levels) free(o->cur.intl_props.props->embedding_levels);
|
||||
if (o->cur.intl_props.props->char_types) free(o->cur.intl_props.props->char_types);
|
||||
o->magic = 0;
|
||||
free(o);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,12 +40,33 @@ evas_bidi_is_rtl_str(const Eina_Unicode *str)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
evas_bidi_shape_string(Eina_Unicode *ustr, const Evas_BiDi_Props *bidi_props, size_t len)
|
||||
{
|
||||
EvasBiDiJoiningType *join_types = NULL;
|
||||
join_types = (EvasBiDiJoiningType *) malloc(sizeof(EvasBiDiJoiningType) * len);
|
||||
if (!join_types)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
fribidi_get_joining_types(ustr, len, join_types);
|
||||
|
||||
fribidi_join_arabic(bidi_props->props->char_types, len, bidi_props->props->embedding_levels + bidi_props->start, join_types);
|
||||
|
||||
|
||||
/* Actually modify the string */
|
||||
fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC,
|
||||
bidi_props->props->embedding_levels + bidi_props->start, len, join_types, ustr);
|
||||
|
||||
if (join_types) free(join_types);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
evas_bidi_update_props(Eina_Unicode *ustr, Evas_BiDi_Props *intl_props)
|
||||
evas_bidi_update_props(const Eina_Unicode *ustr, Evas_BiDi_Paragraph_Props *bidi_props)
|
||||
{
|
||||
EvasBiDiCharType *char_types = NULL;
|
||||
EvasBiDiLevel *embedding_levels = NULL;
|
||||
EvasBiDiJoiningType *join_types = NULL;
|
||||
size_t len;
|
||||
|
||||
if (!ustr)
|
||||
|
@ -74,53 +95,36 @@ evas_bidi_update_props(Eina_Unicode *ustr, Evas_BiDi_Props *intl_props)
|
|||
len = -2;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!fribidi_get_par_embedding_levels(char_types, len, &intl_props->direction, embedding_levels))
|
||||
if (!fribidi_get_par_embedding_levels(char_types, len, &bidi_props->direction, embedding_levels))
|
||||
{
|
||||
len = -2;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
join_types = (EvasBiDiJoiningType *) malloc(sizeof(EvasBiDiJoiningType) * len);
|
||||
if (!join_types)
|
||||
{
|
||||
len = -2;
|
||||
goto cleanup;
|
||||
}
|
||||
fribidi_get_joining_types(ustr, len, join_types);
|
||||
|
||||
fribidi_join_arabic(char_types, len, embedding_levels, join_types);
|
||||
|
||||
|
||||
/* Actually modify the string */
|
||||
fribidi_shape(FRIBIDI_FLAGS_DEFAULT | FRIBIDI_FLAGS_ARABIC, embedding_levels, len, join_types,
|
||||
ustr);
|
||||
|
||||
/* clean up */
|
||||
if (intl_props->embedding_levels)
|
||||
if (bidi_props->embedding_levels)
|
||||
{
|
||||
free(intl_props->embedding_levels);
|
||||
free(bidi_props->embedding_levels);
|
||||
}
|
||||
intl_props->embedding_levels = embedding_levels;
|
||||
bidi_props->embedding_levels = embedding_levels;
|
||||
|
||||
/* clean up */
|
||||
|
||||
if (intl_props->char_types)
|
||||
if (bidi_props->char_types)
|
||||
{
|
||||
free(intl_props->char_types);
|
||||
free(bidi_props->char_types);
|
||||
}
|
||||
intl_props->char_types = char_types;
|
||||
bidi_props->char_types = char_types;
|
||||
|
||||
|
||||
if (join_types) free(join_types);
|
||||
|
||||
return len;
|
||||
|
||||
/* Cleanup */
|
||||
cleanup:
|
||||
if (join_types) free(join_types);
|
||||
if (char_types) free(char_types);
|
||||
if (embedding_levels) free(embedding_levels);
|
||||
evas_bidi_props_clean(intl_props); /*Mark that we don't need bidi handling */
|
||||
evas_bidi_paragraph_props_clean(bidi_props); /*Mark that we don't need bidi handling */
|
||||
return len;
|
||||
}
|
||||
|
||||
|
@ -130,7 +134,7 @@ evas_bidi_props_reorder_line(Eina_Unicode *ustr, const Evas_BiDi_Props *intl_pro
|
|||
EvasBiDiStrIndex *v_to_l = NULL;
|
||||
size_t len;
|
||||
|
||||
if (!EVAS_BIDI_IS_BIDI_PROP(intl_props))
|
||||
if (!EVAS_BIDI_IS_BIDI_PROP(intl_props->props))
|
||||
return 0;
|
||||
|
||||
len = eina_unicode_strlen(ustr);
|
||||
|
@ -151,9 +155,9 @@ evas_bidi_props_reorder_line(Eina_Unicode *ustr, const Evas_BiDi_Props *intl_pro
|
|||
|
||||
/* Shaping must be done *BEFORE* breaking to lines so there's no choice but
|
||||
doing it in textblock. */
|
||||
if (!fribidi_reorder_line (FRIBIDI_FLAGS_DEFAULT, intl_props->char_types,
|
||||
len, 0, intl_props->direction,
|
||||
intl_props->embedding_levels, ustr, v_to_l))
|
||||
if (!fribidi_reorder_line (FRIBIDI_FLAGS_DEFAULT, intl_props->props->char_types + intl_props->start,
|
||||
len, 0, intl_props->props->direction,
|
||||
intl_props->props->embedding_levels + intl_props->start, ustr, v_to_l))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
@ -194,9 +198,16 @@ evas_bidi_is_rtl_char(EvasBiDiLevel *embedded_level_list, EvasBiDiStrIndex index
|
|||
}
|
||||
|
||||
void
|
||||
evas_bidi_props_clean(Evas_BiDi_Props *intl_props)
|
||||
evas_bidi_paragraph_props_clean(Evas_BiDi_Paragraph_Props *bidi_props)
|
||||
{
|
||||
_SAFE_FREE(intl_props->embedding_levels);
|
||||
_SAFE_FREE(intl_props->char_types);
|
||||
_SAFE_FREE(bidi_props->embedding_levels);
|
||||
_SAFE_FREE(bidi_props->char_types);
|
||||
}
|
||||
void
|
||||
evas_bidi_props_clean(Evas_BiDi_Props *bidi_props)
|
||||
{
|
||||
if (!bidi_props) return;
|
||||
evas_bidi_paragraph_props_clean(bidi_props->props);
|
||||
bidi_props->props = NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -40,21 +40,27 @@ _EVAS_BIDI_TYPEDEF(StrIndex);
|
|||
_EVAS_BIDI_TYPEDEF(Level);
|
||||
_EVAS_BIDI_TYPEDEF(JoiningType);
|
||||
|
||||
typedef struct _Evas_BiDi_Paragraph_Props Evas_BiDi_Paragraph_Props;
|
||||
typedef struct _Evas_BiDi_Props Evas_BiDi_Props;
|
||||
|
||||
/* This structure defines a set of properties of a BiDi string. In case of a
|
||||
* non-bidi string, all values should be NULL.
|
||||
* To check if a structure describes a bidi string or not, use the macro
|
||||
* EVAS_BIDI_IS_BIDI_PROP. RTL-only strings are also treated as bidi ATM.
|
||||
*/
|
||||
struct _Evas_BiDi_Props {
|
||||
struct _Evas_BiDi_Paragraph_Props {
|
||||
EvasBiDiCharType *char_types; /* BiDi char types */
|
||||
EvasBiDiLevel *embedding_levels; /* BiDi embedding levels */
|
||||
#ifdef USE_FRIBIDI
|
||||
EvasBiDiParType direction; /* The paragraph direction, FIXME-tom: should be a
|
||||
pointer to the paragraph structure */
|
||||
EvasBiDiParType direction;
|
||||
#endif
|
||||
};
|
||||
|
||||
typedef struct _Evas_BiDi_Props Evas_BiDi_Props;
|
||||
struct _Evas_BiDi_Props {
|
||||
Evas_BiDi_Paragraph_Props *props;
|
||||
size_t start;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef USE_FRIBIDI
|
||||
|
@ -92,13 +98,18 @@ evas_bidi_props_reorder_line(Eina_Unicode *text, const Evas_BiDi_Props *intl_pro
|
|||
* Return value: the length of the string.
|
||||
*/
|
||||
int
|
||||
evas_bidi_update_props(Eina_Unicode *text, Evas_BiDi_Props *intl_props) EINA_ARG_NONNULL(1, 2);
|
||||
evas_bidi_update_props(const Eina_Unicode *text, Evas_BiDi_Paragraph_Props *intl_props) EINA_ARG_NONNULL(1, 2);
|
||||
|
||||
/* Actually shape the string */
|
||||
Eina_Bool
|
||||
evas_bidi_shape_string(Eina_Unicode *ustr, const Evas_BiDi_Props *intl_props, size_t len);
|
||||
/* Cleans and frees the international properties. - Just the content, not the
|
||||
* poitner itself.
|
||||
*/
|
||||
void
|
||||
evas_bidi_props_clean(Evas_BiDi_Props *intl_props) EINA_ARG_NONNULL(1);
|
||||
void
|
||||
evas_bidi_paragraph_props_clean(Evas_BiDi_Paragraph_Props *bidi_props) EINA_ARG_NONNULL(1);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -544,8 +544,8 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
|||
* index is now the index and the other way around.
|
||||
* There is a slight exception when there are compositing chars
|
||||
* involved.*/
|
||||
if (intl_props &&
|
||||
evas_bidi_is_rtl_char(intl_props->embedding_levels, char_index) &&
|
||||
if (intl_props && intl_props->props &&
|
||||
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
|
||||
fg->glyph->advance.x >> 16 > 0)
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
||||
|
@ -872,7 +872,7 @@ evas_font_word_prerender(RGBA_Draw_Context *dc, const Eina_Unicode *in_text, Eva
|
|||
* There is a slight exception when there are compositing chars
|
||||
* involved.*/
|
||||
if (intl_props &&
|
||||
evas_bidi_is_rtl_char(intl_props->embedding_levels, char_index) &&
|
||||
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
|
||||
ci->fg->glyph->advance.x >> 16 > 0)
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, ci->index, prev_index, &kern))
|
||||
|
|
|
@ -258,7 +258,7 @@ evas_common_font_query_advance(RGBA_Font *fn, const Eina_Unicode *text, const Ev
|
|||
* There is a slight exception when there are compositing chars
|
||||
* involved.*/
|
||||
if (intl_props &&
|
||||
evas_bidi_is_rtl_char(intl_props->embedding_levels, char_index) &&
|
||||
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
|
||||
fg->glyph->advance.x >> 16 > 0)
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
||||
|
@ -384,7 +384,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const Eina_Unicode *in_text, c
|
|||
* There is a slight exception when there are compositing chars
|
||||
* involved.*/
|
||||
if (intl_props &&
|
||||
evas_bidi_is_rtl_char(intl_props->embedding_levels, char_index) &&
|
||||
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
|
||||
fg->glyph->advance.x >> 16 > 0)
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
||||
|
@ -541,7 +541,7 @@ evas_common_font_query_char_at_coords(RGBA_Font *fn, const Eina_Unicode *in_text
|
|||
* There is a slight exception when there are compositing chars
|
||||
* involved.*/
|
||||
if (intl_props &&
|
||||
evas_bidi_is_rtl_char(intl_props->embedding_levels, char_index) &&
|
||||
evas_bidi_is_rtl_char(intl_props->props->embedding_levels, char_index) &&
|
||||
fg->glyph->advance.x >> 16 > 0)
|
||||
{
|
||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
||||
|
|
|
@ -197,16 +197,18 @@ evas_imaging_font_line_advance_get(const Evas_Imaging_Font *fn)
|
|||
EAPI void
|
||||
evas_imaging_font_string_advance_get(const Evas_Imaging_Font *fn, const char *str, int *x, int *y)
|
||||
{
|
||||
Evas_BiDi_Props intl_props;
|
||||
Evas_BiDi_Props bidi_props;
|
||||
Evas_BiDi_Paragraph_Props bidi_par_props;
|
||||
bidi_props.props = &bidi_par_props;
|
||||
Eina_Unicode *ustr;
|
||||
if (!fn) return;
|
||||
ustr = evas_common_encoding_utf8_to_unicode(str, NULL);
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_update_props(ustr, &intl_props);
|
||||
evas_bidi_update_props(ustr, &bidi_par_props);
|
||||
#endif
|
||||
evas_common_font_query_advance(fn->font, ustr, &intl_props, x, y);
|
||||
evas_common_font_query_advance(fn->font, ustr, &bidi_props, x, y);
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_props_clean(&intl_props);
|
||||
evas_bidi_props_clean(&bidi_props);
|
||||
#endif
|
||||
if (ustr) free(ustr);
|
||||
}
|
||||
|
@ -215,11 +217,13 @@ EAPI void
|
|||
evas_imaging_font_string_size_query(const Evas_Imaging_Font *fn, const char *str, int *w, int *h)
|
||||
{
|
||||
Evas_BiDi_Props intl_props;
|
||||
Evas_BiDi_Paragraph_Props bidi_paragraph_props;
|
||||
intl_props.props = &bidi_paragraph_props;
|
||||
Eina_Unicode *ustr;
|
||||
if (!fn) return;
|
||||
ustr = evas_common_encoding_utf8_to_unicode(str, NULL);
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_update_props(ustr, &intl_props);
|
||||
evas_bidi_update_props(ustr, &bidi_paragraph_props);
|
||||
#endif
|
||||
evas_common_font_query_size(fn->font, ustr, &intl_props, w, h);
|
||||
#ifdef BIDI_SUPPORT
|
||||
|
@ -246,11 +250,13 @@ evas_imaging_font_string_char_coords_get(const Evas_Imaging_Font *fn, const char
|
|||
{
|
||||
int ret;
|
||||
Evas_BiDi_Props intl_props;
|
||||
Evas_BiDi_Paragraph_Props bidi_paragraph_props;
|
||||
intl_props.props = &bidi_paragraph_props;
|
||||
Eina_Unicode *ustr;
|
||||
if (!fn) return 0;
|
||||
ustr = evas_common_encoding_utf8_to_unicode(str, NULL);
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_update_props(ustr, &intl_props);
|
||||
evas_bidi_update_props(ustr, &bidi_paragraph_props);
|
||||
#endif
|
||||
ret = evas_common_font_query_char_coords(fn->font, ustr, &intl_props, pos, cx, cy, cw, ch);
|
||||
#ifdef BIDI_SUPPORT
|
||||
|
@ -265,11 +271,13 @@ evas_imaging_font_string_char_at_coords_get(const Evas_Imaging_Font *fn, const c
|
|||
{
|
||||
int ret;
|
||||
Evas_BiDi_Props intl_props;
|
||||
Evas_BiDi_Paragraph_Props bidi_paragraph_props;
|
||||
intl_props.props = &bidi_paragraph_props;
|
||||
Eina_Unicode *ustr;
|
||||
if (!fn) return -1;
|
||||
ustr = evas_common_encoding_utf8_to_unicode(str, NULL);
|
||||
#ifdef BIDI_SUPPORT
|
||||
evas_bidi_update_props(ustr, &intl_props);
|
||||
evas_bidi_update_props(ustr, &bidi_paragraph_props);
|
||||
#endif
|
||||
ret = evas_common_font_query_char_at_coords(fn->font, ustr, &intl_props, x, y, cx, cy, cw, ch);
|
||||
#ifdef BIDI_SUPPORT
|
||||
|
|
Loading…
Reference in New Issue