#ifdef BIDI_SUPPORT
evas_bidi_paragraph_props_unref(o->cur.intl_props.props);
o->cur.intl_props.props = evas_bidi_paragraph_props_get(text);
- evas_bidi_shape_string(text, &o->cur.intl_props, len);
+ evas_bidi_shape_string(text, o->cur.intl_props.props, 0, len);
#endif
if (o->cur.text) eina_ustringshare_del(o->cur.text);
if (o->cur.utf8_text) eina_stringshare_del(o->cur.utf8_text);
do
{
Evas_Object_Textblock_Text_Item *new_ti;
- cutoff = evas_bidi_end_of_run_get(&ti->parent.bidi_props, len);
+ cutoff = evas_bidi_end_of_run_get(ti->parent.text_node->bidi_props,
+ ti->parent.text_pos, len);
if (cutoff > 0)
{
new_ti = _layout_text_item_new(c, fmt, ti->text + cutoff);
/* Use the string, just cut the relevant parts */
else
{
- Evas_BiDi_Props props;
str = eina_ustrbuf_string_get(n->unicode);
alloc_str = eina_unicode_strdup(str + start);
str = alloc_str;
/* Shape the string */
- props.start = start;
- props.props = n->bidi_props;
# ifdef BIDI_SUPPORT
- evas_bidi_shape_string(alloc_str, &props, off);
+ evas_bidi_shape_string(alloc_str, n->bidi_props, start, off);
# endif
}
}
/* Adjust if the char is an rtl char */
if (ret >= 0)
{
- Evas_BiDi_Props props;
- props.props = dir_cur->node->bidi_props;
- props.start = 0;
-
if ((!before_char &&
- evas_bidi_is_rtl_char(&props, dir_cur->pos)) ||
+ evas_bidi_is_rtl_char(dir_cur->node->bidi_props, 0,
+ dir_cur->pos)) ||
(before_char &&
- !evas_bidi_is_rtl_char(&props, dir_cur->pos)))
+ !evas_bidi_is_rtl_char(dir_cur->node->bidi_props, 0,
+ dir_cur->pos)))
{
/* Just don't advance the width */
if (dir && dir_cur && dir_cur->node)
{
#ifdef BIDI_SUPPORT
- Evas_BiDi_Props props;
- props.props = dir_cur->node->bidi_props;
- props.start = 0;
-
- *dir = (evas_bidi_is_rtl_char(&props, dir_cur->pos)) ?
+ *dir = (evas_bidi_is_rtl_char(dir_cur->node->bidi_props, dir_cur->pos,
+ 0)) ?
EVAS_BIDI_DIRECTION_RTL : EVAS_BIDI_DIRECTION_LTR;
#else
*dir = EVAS_BIDI_DIRECTION_LTR;
if ((start && !switch_items) || (!start && switch_items))
{
#ifdef BIDI_SUPPORT
- if (evas_bidi_is_rtl_char(&it->bidi_props, 0))
+ if (evas_bidi_is_rtl_char(it->text_node->bidi_props, 0, 0))
{
*w = *x + *w;
*x = 0;
else
{
#ifdef BIDI_SUPPORT
- if (evas_bidi_is_rtl_char(&it->bidi_props, 0))
+ if (evas_bidi_is_rtl_char(it->text_node->bidi_props, 0, 0))
{
*x = *x + *w;
*w = it->adv - *x;
}
#ifdef BIDI_SUPPORT
- if (evas_bidi_is_rtl_char(&ti->parent.bidi_props, 0))
+ if (evas_bidi_is_rtl_char(ti->parent.text_node->bidi_props, 0, 0))
{
x = x1 + w1;
w = x2 + w2 - x;
*
* @param str The string to shape
* @param bidi_props the bidi props to shaped according.
+ * @param start the start of the string to shape (offset in bidi_props)
* @param len the length of th string.
* @return #EINA_TRUE on success, #EINA_FALSE otherwise.
*/
Eina_Bool
-evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Props *bidi_props, size_t len)
+evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, size_t len)
{
FriBidiChar *ustr, *base_ustr = NULL;
- if (!bidi_props->props)
+ if (!bidi_props)
return EINA_FALSE;
/* The size of fribidichar is different than eina_unicode, convert */
}
fribidi_get_joining_types(ustr, len, join_types);
- fribidi_join_arabic(bidi_props->props->char_types + bidi_props->start, len, bidi_props->props->embedding_levels + bidi_props->start, join_types);
+ fribidi_join_arabic(bidi_props->char_types + start, len,
+ bidi_props->embedding_levels + 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);
+ bidi_props->embedding_levels + start, len, join_types, ustr);
if (join_types) free(join_types);
* @internal
* Returns the end of the current run of text
*
- * @param bidi_props the properties
+ * @param bidi_props the paragraph properties
+ * @param start where to start looking from
* @param len the length of the string
* @return the position of the end of the run (offset from
* bidi_props->props->start), 0 when there is no end (i.e all the text)
*/
int
-evas_bidi_end_of_run_get(const Evas_BiDi_Props *bidi_props, int len)
+evas_bidi_end_of_run_get(const Evas_BiDi_Paragraph_Props *bidi_props,
+ size_t start, int len)
{
EvasBiDiLevel *i;
EvasBiDiLevel base;
- if (!bidi_props || !bidi_props->props || (len <= 0))
+ if (!bidi_props || (len <= 0))
return 0;
- i = bidi_props->props->embedding_levels + bidi_props->start;
+ i = bidi_props->embedding_levels + start;
base = *i;
for ( ; (len > 0) && (base == *i) ; len--, i++)
;
{
return 0;
}
- return i - (bidi_props->props->embedding_levels + bidi_props->start);
+ return i - (bidi_props->embedding_levels + start);
}
/**
* Checks if the char is rtl oriented. I.e even a neutral char can become rtl
* if surrounded by rtl chars.
*
- * @param bidi_props The bidi properties
- * @param index the index of the string.
+ * @param bidi_props The bidi paragraph properties
+ * @param start the base position
+ * @param index the offset from the base position.
* @return #EINA_TRUE if true, #EINA_FALSE otherwise.
*/
Eina_Bool
-evas_bidi_is_rtl_char(const Evas_BiDi_Props *bidi_props, EvasBiDiStrIndex index)
+evas_bidi_is_rtl_char(const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, EvasBiDiStrIndex index)
{
- if(!bidi_props || !bidi_props->props || index < 0)
+ if(!bidi_props || index < 0)
return EINA_FALSE;
return (FRIBIDI_IS_RTL(
- bidi_props->props->embedding_levels[index + bidi_props->start]))
+ bidi_props->embedding_levels[index + start]))
? EINA_TRUE : EINA_FALSE;
}
evas_bidi_is_rtl_str(const Eina_Unicode *str);
Eina_Bool
-evas_bidi_is_rtl_char(const Evas_BiDi_Props *bidi_props, EvasBiDiStrIndex index);
+evas_bidi_is_rtl_char(const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, EvasBiDiStrIndex index);
int
-evas_bidi_end_of_run_get(const Evas_BiDi_Props *bidi_props, int len);
+evas_bidi_end_of_run_get(const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, int len);
Eina_Bool
evas_bidi_props_reorder_line(Eina_Unicode *eina_ustr, size_t start, size_t len, const Evas_BiDi_Paragraph_Props *props, EvasBiDiStrIndex **_v_to_l);
evas_bidi_props_copy_and_ref(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst);
Eina_Bool
-evas_bidi_shape_string(Eina_Unicode *ustr, const Evas_BiDi_Props *intl_props, size_t len);
+evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, size_t len);
void
evas_bidi_props_clean(Evas_BiDi_Props *intl_props) EINA_ARG_NONNULL(1);
/* around. There is a slight exception when there are */ \
/* compositing chars involved.*/ \
if (intl_props && \
- evas_bidi_is_rtl_char(intl_props, char_index) && \
+ evas_bidi_is_rtl_char(intl_props->props, intl_props->start, char_index) && \
adv > 0) \
{ \
if (evas_common_font_query_kerning(fi, index, prev_index, &kern)) \
/* if it's rtl then the location is the left of the string,
* otherwise, the right. */
#ifdef BIDI_SUPPORT
- if (evas_bidi_is_rtl_char(intl_props, 0))
+ if (evas_bidi_is_rtl_char(intl_props->props, intl_props->start, 0))
{
if (cx) *cx = 0;
if (ch) *ch = asc + desc;
/* if it's rtl then the location is the left of the string,
* otherwise, the right. */
#ifdef BIDI_SUPPORT
- if (evas_bidi_is_rtl_char(intl_props, 0))
+ if (evas_bidi_is_rtl_char(intl_props->props, 0, 0))
{
if (cpen_x) *cpen_x = 0;
if (ch) *ch = asc + desc;