free(bidi_props->char_types);
}
bidi_props->char_types = char_types;
+
+ bidi_props->len = len;
if (base_ustr) free(base_ustr);
return len;
}
+int
+evas_bidi_update_props_dup(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst)
+{
+ dst->start = src->start;
+ dst->props = NULL;
+ if (!src->props) return 1;
+ dst->props = malloc(sizeof(Evas_BiDi_Paragraph_Props));
+ if (!dst->props) return 0;
+ if (src->props->len > 0)
+ {
+ if (src->props->char_types)
+ {
+ dst->props->char_types =
+ malloc(sizeof(EvasBiDiCharType) * src->props->len);
+ if (!dst->props->char_types)
+ {
+ free(dst->props);
+ dst->props = NULL;
+ dst->start = 0;
+ return 0;
+ }
+ memcpy(dst->props->char_types, src->props->char_types,
+ sizeof(EvasBiDiCharType) * src->props->len);
+ }
+ else
+ dst->props->char_types = NULL;
+ if (src->props->embedding_levels)
+ {
+ dst->props->embedding_levels =
+ malloc(sizeof(EvasBiDiLevel) * src->props->len);
+ if (!dst->props->embedding_levels)
+ {
+ if (dst->props->char_types) free(dst->props->char_types);
+ free(dst->props);
+ dst->props = NULL;
+ dst->start = 0;
+ return 0;
+ }
+ memcpy(dst->props->embedding_levels, src->props->embedding_levels,
+ sizeof(EvasBiDiLevel) * src->props->len);
+ }
+ else
+ dst->props->embedding_levels = NULL;
+ }
+ else
+ {
+ dst->props->char_types = NULL;
+ dst->props->embedding_levels = NULL;
+ dst->props->len = 0;
+ }
+ dst->props->len = src->props->len;
+ dst->props->direction = src->props->direction;
+ return 1;
+}
+
/**
* @internal
* Reorders ustr according to the bidi props.
struct _Evas_BiDi_Paragraph_Props {
EvasBiDiCharType *char_types; /* BiDi char types */
EvasBiDiLevel *embedding_levels; /* BiDi embedding levels */
+ int len; /* length of char_types & embedding_levels */
#ifdef USE_FRIBIDI
EvasBiDiParType direction;
#endif
int
evas_bidi_update_props(const Eina_Unicode *text, Evas_BiDi_Paragraph_Props *intl_props) EINA_ARG_NONNULL(1, 2);
+int
+evas_bidi_update_props_dup(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);
{
char *p;
int tmp;
-#ifdef EVAS_FRAME_QUEUING
- LKI(lock_font_draw);
- LKI(lock_fribidi);
-#endif
if ((p = getenv("EVAS_WORD_CACHE_MAX_WORDS")))
{
tmp = strtol(p,NULL,10);
#ifdef EVAS_FRAME_QUEUING
EAPI void
evas_common_font_draw_finish(void)
-{
- LKD(lock_font_draw);
- LKD(lock_fribidi);
+{
}
#endif
#endif
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
Eina_Unicode *visual_text;
visual_text = eina_unicode_strdup(in_text);
{
text = in_text;
}
+ LKU(lock_fribidi);
#endif
if (ext_w <= 0) return;
if (ext_h <= 0) return;
-#ifndef EVAS_FRAME_QUEUING
+#ifdef EVAS_FRAME_QUEUING
LKL(fn->lock);
#endif
// evas_common_font_size_use(fn);
}
dc->clip.use = c; dc->clip.x = cx; dc->clip.y = cy; dc->clip.w = cw; dc->clip.h = ch;
}
-#ifndef EVAS_FRAME_QUEUING
+#ifdef EVAS_FRAME_QUEUING
LKU(fn->lock);
#endif
}
{
int kern = 0;
# ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
pen_x += kern;
}
else
-# endif
- {
-
+ {
if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern))
pen_x += kern;
- }
+ }
+ LKU(lock_fribidi);
+# else
+
+ if (evas_common_font_query_kerning(fi, prev_index, ci->index, &kern))
+ pen_x += kern;
+# endif
}
-
+
pface = fi->src->ft.face;
LKU(fi->ft_mutex);
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* 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->props->embedding_levels, char_index) &&
- fg->glyph->advance.x >> 16 > 0)
+ 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))
- pen_x += kern;
+ pen_x += kern;
}
else
-#endif
{
-
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
- pen_x += kern;
+ pen_x += kern;
}
+ LKU(lock_fribidi);
+#else
+ if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
+ pen_x += kern;
+#endif
}
pface = fi->src->ft.face;
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
pen_x += kern;
}
else
-#endif
{
-
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
pen_x += kern;
}
+ LKU(lock_fribidi);
+#else
+ if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
+ pen_x += kern;
+#endif
}
pface = fi->src->ft.face;
EvasBiDiStrIndex *visual_to_logical = NULL;
Eina_Unicode *visual_text;
+ LKL(lock_fribidi);
visual_text = eina_unicode_strdup(in_text);
-
if (visual_text)
{
evas_bidi_props_reorder_line(visual_text, intl_props, &visual_to_logical);
text = in_text;
}
len = eina_unicode_strlen(text);
+ LKU(lock_fribidi);
#endif
fi = fn->fonts->data;
desc = evas_common_font_max_descent_get(fn);
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* Get the position in the visual string because those are the coords we care about */
position = evas_bidi_position_logical_to_visual(visual_to_logical, len, pos);
+ LKU(lock_fribidi);
#else
position = pos;
#endif
EvasBiDiStrIndex *visual_to_logical = NULL;
Eina_Unicode *visual_text;
+ LKL(lock_fribidi);
visual_text = eina_unicode_strdup(in_text);
if (visual_text)
text = in_text;
}
len = eina_unicode_strlen(text);
+ LKU(lock_fribidi);
#endif
fi = fn->fonts->data;
if (cw) *cw = chr_w;
if (ch) *ch = asc + desc;
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* we found the char position of the wanted char in the
* visual string, we now need to translate it to the
* position in the logical string */
position = evas_bidi_position_visual_to_logical(visual_to_logical, position);
+ LKU(lock_fribidi);
#endif
ret_val = position;
goto end;
(pface == fi->src->ft.face))
{
#ifdef BIDI_SUPPORT
+ LKL(lock_fribidi);
/* if it's rtl, the kerning matching should be reversed, i.e prev
* index is now the index and the other way around.
* There is a slight exception when there are compositing chars
pen_x += kern;
}
else
-#endif
{
-
if (evas_common_font_query_kerning(fi, prev_index, index,
&kern))
pen_x += kern;
}
+ LKU(lock_fribidi);
+#else
+ if (evas_common_font_query_kerning(fi, prev_index, index,
+ &kern))
+ pen_x += kern;
+#endif
}
pface = fi->src->ft.face;
fg = evas_common_font_int_cache_glyph_get(fi, index);
#else
evas_common_font_free(op->op.text.font);
#endif
+#ifdef BIDI_SUPPORT
+ evas_bidi_props_clean(&(op->op.text.intl_props));
+#endif
free(op->op.text.text);
evas_common_pipe_op_free(op);
}
#endif
evas_common_font_draw(dst, &(context),
op->op.text.font, op->op.text.x, op->op.text.y,
- op->op.text.text, op->op.text.intl_props);
+ op->op.text.text, &op->op.text.intl_props);
}
else
{
evas_common_font_draw(dst, &(op->context),
op->op.text.font, op->op.text.x, op->op.text.y,
- op->op.text.text, op->op.text.intl_props);
+ op->op.text.text, &op->op.text.intl_props);
}
}
op->op.text.x = x;
op->op.text.y = y;
op->op.text.text = eina_unicode_strdup(text);
- op->op.text.intl_props = intl_props;
+#ifdef BIDI_SUPPORT
+ evas_bidi_update_props_dup(intl_props, &(op->op.text.intl_props));
+#endif
#ifdef EVAS_FRAME_QUEUING
LKL(fn->ref_fq_add);
fn->ref_fq[0]++;
RGBA_Font *font;
int x, y;
Eina_Unicode *text;
- const Evas_BiDi_Props *intl_props;
+ Evas_BiDi_Props intl_props;
} text;
struct {
RGBA_Image *src;