forked from enlightenment/efl
revertg big R to L patches because they break cursors and selection.... BACK
boy BACK! SVN revision: 40783
This commit is contained in:
parent
adab71dcfd
commit
c3b8b4ee14
|
@ -795,6 +795,7 @@ _anchors_clear(Evas_Textblock_Cursor *c, Evas_Object *o, Entry *en)
|
||||||
free(sel);
|
free(sel);
|
||||||
an->sel = eina_list_remove_list(an->sel, an->sel);
|
an->sel = eina_list_remove_list(an->sel, an->sel);
|
||||||
}
|
}
|
||||||
|
free(an->name);
|
||||||
free(an);
|
free(an);
|
||||||
en->anchors = eina_list_remove_list(en->anchors, en->anchors);
|
en->anchors = eina_list_remove_list(en->anchors, en->anchors);
|
||||||
}
|
}
|
||||||
|
@ -1676,6 +1677,9 @@ _edje_entry_real_part_shutdown(Edje_Real_Part *rp)
|
||||||
ecore_imf_context_del(en->imf_context);
|
ecore_imf_context_del(en->imf_context);
|
||||||
en->imf_context = NULL;
|
en->imf_context = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edje_object_signal_callback_del(rp->edje->obj, "focus,part,in", rp->part->name, _edje_entry_focus_in_cb);
|
||||||
|
edje_object_signal_callback_del(rp->edje->obj, "focus,part,out", rp->part->name, _edje_entry_focus_out_cb);
|
||||||
ecore_imf_shutdown();
|
ecore_imf_shutdown();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -168,13 +168,13 @@ _edje_text_fit_x(Edje *ed, Edje_Real_Part *ep,
|
||||||
if (tw > sw)
|
if (tw > sw)
|
||||||
{
|
{
|
||||||
if (params->text.elipsis != 0.0)
|
if (params->text.elipsis != 0.0)
|
||||||
/* should be the last in text! not the rightmost */
|
c1 = evas_object_text_char_coords_get(ep->object,
|
||||||
c1 = evas_object_text_last_up_to_pos(ep->object,
|
-p + l, th / 2,
|
||||||
-p + l, th / 2);
|
NULL, NULL, NULL, NULL);
|
||||||
if (params->text.elipsis != 1.0)
|
if (params->text.elipsis != 1.0)
|
||||||
/* should be the last in text! not the rightmost */
|
c2 = evas_object_text_char_coords_get(ep->object,
|
||||||
c2 = evas_object_text_last_up_to_pos(ep->object,
|
-p + sw - r, th / 2,
|
||||||
-p + sw - r, th / 2);
|
NULL, NULL, NULL, NULL);
|
||||||
if ((c1 < 0) && (c2 < 0))
|
if ((c1 < 0) && (c2 < 0))
|
||||||
{
|
{
|
||||||
c1 = 0;
|
c1 = 0;
|
||||||
|
|
|
@ -648,7 +648,6 @@ extern "C" {
|
||||||
EAPI Evas_Coord evas_object_text_inset_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
EAPI Evas_Coord evas_object_text_inset_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||||
EAPI int evas_object_text_char_pos_get (const Evas_Object *obj, int pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
EAPI int evas_object_text_char_pos_get (const Evas_Object *obj, int pos, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
||||||
EAPI int evas_object_text_char_coords_get (const Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
EAPI int evas_object_text_char_coords_get (const Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1);
|
||||||
EAPI int evas_object_text_last_up_to_pos(const Evas_Object *obj, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1);
|
|
||||||
EAPI Evas_Text_Style_Type evas_object_text_style_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
EAPI Evas_Text_Style_Type evas_object_text_style_get (const Evas_Object *obj) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_PURE;
|
||||||
EAPI void evas_object_text_style_set (Evas_Object *obj, Evas_Text_Style_Type type) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_text_style_set (Evas_Object *obj, Evas_Text_Style_Type type) EINA_ARG_NONNULL(1);
|
||||||
EAPI void evas_object_text_shadow_color_set (Evas_Object *obj, int r, int g, int b, int a) EINA_ARG_NONNULL(1);
|
EAPI void evas_object_text_shadow_color_set (Evas_Object *obj, int r, int g, int b, int a) EINA_ARG_NONNULL(1);
|
||||||
|
|
|
@ -614,40 +614,6 @@ evas_object_text_char_pos_get(const Evas_Object *obj, int pos, Evas_Coord *cx, E
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the logical position of the last char in the text
|
|
||||||
* up to the pos given. this is NOT the position of the last char
|
|
||||||
* because of the possibilty of RTL in the text.
|
|
||||||
* To be documented.
|
|
||||||
*
|
|
||||||
* FIXME: To be fixed.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
EAPI int
|
|
||||||
evas_object_text_last_up_to_pos(const Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
|
||||||
{
|
|
||||||
Evas_Object_Text *o;
|
|
||||||
int inset;
|
|
||||||
|
|
||||||
MAGIC_CHECK(obj, Evas_Object, MAGIC_OBJ);
|
|
||||||
return -1;
|
|
||||||
MAGIC_CHECK_END();
|
|
||||||
o = (Evas_Object_Text *)(obj->object_data);
|
|
||||||
MAGIC_CHECK(o, Evas_Object_Text, MAGIC_OBJ_TEXT);
|
|
||||||
return -1;
|
|
||||||
MAGIC_CHECK_END();
|
|
||||||
if (!o->engine_data) return -1;
|
|
||||||
if (!o->cur.text) return -1;
|
|
||||||
inset =
|
|
||||||
ENFN->font_inset_get(ENDT, o->engine_data, o->cur.text);
|
|
||||||
return ENFN->font_last_up_to_pos(ENDT,
|
|
||||||
o->engine_data,
|
|
||||||
o->cur.text,
|
|
||||||
x + inset,
|
|
||||||
y - o->max_ascent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To be documented.
|
* To be documented.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1540,15 +1540,17 @@ _layout_item_new(Ctxt *c __UNUSED__, Evas_Object_Textblock_Format *fmt, char *st
|
||||||
static int
|
static int
|
||||||
_layout_text_cutoff_get(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Textblock_Item *it)
|
_layout_text_cutoff_get(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Textblock_Item *it)
|
||||||
{
|
{
|
||||||
|
int cx, cy, cw, ch;
|
||||||
|
|
||||||
if (fmt->font.font)
|
if (fmt->font.font)
|
||||||
return c->ENFN->font_last_up_to_pos(c->ENDT, fmt->font.font, it->text,
|
return c->ENFN->font_char_at_coords_get(c->ENDT, fmt->font.font, it->text,
|
||||||
c->w -
|
c->w -
|
||||||
c->o->style_pad.l -
|
c->o->style_pad.l -
|
||||||
c->o->style_pad.r -
|
c->o->style_pad.r -
|
||||||
c->marginl -
|
c->marginl -
|
||||||
c->marginr -
|
c->marginr -
|
||||||
c->x,
|
c->x,
|
||||||
0);
|
0, &cx, &cy, &cw, &ch);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1588,6 +1590,7 @@ _layout_word_start(char *str, int start)
|
||||||
if (_is_white(chr)) break;
|
if (_is_white(chr)) break;
|
||||||
tp = p;
|
tp = p;
|
||||||
}
|
}
|
||||||
|
p = tp;
|
||||||
if (p < 0) p = 0;
|
if (p < 0) p = 0;
|
||||||
if ((p >= 0) && (_is_white(chr)))
|
if ((p >= 0) && (_is_white(chr)))
|
||||||
evas_common_font_utf8_get_next((unsigned char *)(str), &p);
|
evas_common_font_utf8_get_next((unsigned char *)(str), &p);
|
||||||
|
@ -1855,12 +1858,9 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text
|
||||||
c->marginl - c->marginr)))
|
c->marginl - c->marginr)))
|
||||||
{
|
{
|
||||||
wrap = _layout_text_cutoff_get(c, fmt, it);
|
wrap = _layout_text_cutoff_get(c, fmt, it);
|
||||||
/* next line is instead of that awful wrap = 1*/
|
if (wrap == 0) wrap = 1;
|
||||||
if (wrap == 0)
|
|
||||||
evas_common_font_utf8_get_next((unsigned char *)str, &wrap);
|
|
||||||
if (wrap > 0)
|
if (wrap > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (fmt->wrap_word)
|
if (fmt->wrap_word)
|
||||||
{
|
{
|
||||||
index = wrap;
|
index = wrap;
|
||||||
|
@ -1876,10 +1876,7 @@ _layout_text_append(Ctxt *c, Evas_Object_Textblock_Format *fmt, Evas_Object_Text
|
||||||
{
|
{
|
||||||
_layout_item_text_cutoff(c, it, wrap);
|
_layout_item_text_cutoff(c, it, wrap);
|
||||||
twrap = wrap;
|
twrap = wrap;
|
||||||
/*we don't want to move next, that's why it's
|
ch = evas_common_font_utf8_get_next((unsigned char *)str, &twrap);
|
||||||
* commented out.
|
|
||||||
* ch = evas_common_font_utf8_get_next((unsigned char *)str, &twrap);
|
|
||||||
*/
|
|
||||||
str = str + twrap;
|
str = str + twrap;
|
||||||
}
|
}
|
||||||
/* intersects a word */
|
/* intersects a word */
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Internationalization (RTL and Arabic contextualizing)
|
||||||
|
* was added by Tom Hacohen (tom@stosb.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
#include "evas_blend_private.h"
|
#include "evas_blend_private.h"
|
||||||
|
|
||||||
|
@ -172,14 +177,13 @@ evas_common_font_glyph_search(RGBA_Font *fn, RGBA_Font_Int **fi_ret, int gl)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const char *in_text,
|
evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font *fn, int x, int y, const char *text,
|
||||||
RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, RGBA_Font_Int *fi,
|
RGBA_Gfx_Func func, int ext_x, int ext_y, int ext_w, int ext_h, RGBA_Font_Int *fi,
|
||||||
int im_w, int im_h __UNUSED__, int use_kerning
|
int im_w, int im_h __UNUSED__, int use_kerning
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
int chr;
|
int chr;
|
||||||
const char *text = in_text;
|
|
||||||
FT_Face pface = NULL;
|
FT_Face pface = NULL;
|
||||||
FT_UInt prev_index;
|
FT_UInt prev_index;
|
||||||
DATA32 *im;
|
DATA32 *im;
|
||||||
|
@ -187,17 +191,18 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
||||||
int char_index = 0; /* the index of the current char */
|
int char_index = 0; /* the index of the current char */
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
#ifdef INTERNATIONAL_SUPPORT
|
||||||
int len = 0;
|
int bidi_err = 0;
|
||||||
/*FIXME: should get the direction by parmater */
|
/*FIXME: should get the direction by parmater */
|
||||||
EvasIntlParType direction = FRIBIDI_TYPE_ON;
|
FriBidiCharType direction = FRIBIDI_TYPE_ON;
|
||||||
EvasIntlLevel *level_list;
|
FriBidiLevel *level_list;
|
||||||
|
|
||||||
/* change the text to visual ordering and update the level list
|
/* change the text to visual ordering and update the level list
|
||||||
* for as minimum impact on the code as possible just use text as an
|
* for as minimum impact on the code as possible just use text as an
|
||||||
* holder, will change in the future.*/
|
* holder, will change in the future.*/
|
||||||
char *visual_text = evas_intl_utf8_to_visual(in_text, &len, &direction, NULL, NULL, &level_list);
|
{
|
||||||
text = (visual_text) ? visual_text : in_text;
|
char *tmp = evas_intl_utf8_to_visual(text, &bidi_err, &direction, &level_list);
|
||||||
|
text = (tmp) ? tmp : text;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pen_x = x;
|
pen_x = x;
|
||||||
|
@ -212,7 +217,6 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
||||||
int gl, kern;
|
int gl, kern;
|
||||||
|
|
||||||
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
||||||
|
|
||||||
if (gl == 0) break;
|
if (gl == 0) break;
|
||||||
index = evas_common_font_glyph_search(fn, &fi, gl);
|
index = evas_common_font_glyph_search(fn, &fi, gl);
|
||||||
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
||||||
|
@ -386,8 +390,11 @@ evas_common_font_draw_internal(RGBA_Image *dst, RGBA_Draw_Context *dc, RGBA_Font
|
||||||
prev_index = index;
|
prev_index = index;
|
||||||
}
|
}
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
#ifdef INTERNATIONAL_SUPPORT
|
||||||
if (level_list) free(level_list);
|
if (bidi_err >= 0)
|
||||||
if (visual_text) free(visual_text);
|
{
|
||||||
|
free(level_list);
|
||||||
|
free(text);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,12 +196,11 @@ evas_common_font_utf8_get_prev(const unsigned char *buf, int *iindex)
|
||||||
|
|
||||||
if (index <= 0)
|
if (index <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
index--;
|
d = buf[index--];
|
||||||
|
|
||||||
while ((index > 0) && ((buf[index] & 0xc0) == 0x80))
|
while ((index > 0) && ((buf[index] & 0xc0) == 0x80))
|
||||||
index--;
|
index--;
|
||||||
len = *iindex - index;
|
len = *iindex - index;
|
||||||
d = buf[index];
|
|
||||||
|
|
||||||
if (len == 1)
|
if (len == 1)
|
||||||
r = d;
|
r = d;
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
|
|
||||||
#include "evas_intl_utils.h" /*defines INTERNATIONAL_SUPPORT if possible */
|
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_common_font_query_kerning(RGBA_Font_Int* fi,
|
evas_common_font_query_kerning(RGBA_Font_Int* fi,
|
||||||
FT_UInt prev, FT_UInt index,
|
FT_UInt prev, FT_UInt index,
|
||||||
|
@ -59,10 +57,7 @@ evas_common_font_query_kerning(RGBA_Font_Int* fi,
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* string extents
|
/* string extents */
|
||||||
* Note: no need for special rtl handling
|
|
||||||
* we can assume there's not between languages kerning
|
|
||||||
* and that spaces get the same wide anywhere. */
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_font_query_size(RGBA_Font *fn, const char *text, int *w, int *h)
|
evas_common_font_query_size(RGBA_Font *fn, const char *text, int *w, int *h)
|
||||||
{
|
{
|
||||||
|
@ -131,7 +126,6 @@ evas_common_font_query_size(RGBA_Font *fn, const char *text, int *w, int *h)
|
||||||
if (h) *h = evas_common_font_max_ascent_get(fn) + evas_common_font_max_descent_get(fn);
|
if (h) *h = evas_common_font_max_ascent_get(fn) + evas_common_font_max_descent_get(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* text x inset */
|
/* text x inset */
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_common_font_query_inset(RGBA_Font *fn, const char *text)
|
evas_common_font_query_inset(RGBA_Font *fn, const char *text)
|
||||||
|
@ -169,10 +163,7 @@ evas_common_font_query_inset(RGBA_Font *fn, const char *text)
|
||||||
return fg->glyph_out->left;
|
return fg->glyph_out->left;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* h & v advance
|
/* h & v advance */
|
||||||
* Note: no need for special rtl handling
|
|
||||||
* we can assume there's not between languages kerning
|
|
||||||
* and that spaces get the same wide anywhere. */
|
|
||||||
EAPI void
|
EAPI void
|
||||||
evas_common_font_query_advance(RGBA_Font *fn, const char *text, int *h_adv, int *v_adv)
|
evas_common_font_query_advance(RGBA_Font *fn, const char *text, int *h_adv, int *v_adv)
|
||||||
{
|
{
|
||||||
|
@ -225,34 +216,19 @@ evas_common_font_query_advance(RGBA_Font *fn, const char *text, int *h_adv, int
|
||||||
if (h_adv) *h_adv = pen_x - start_x;
|
if (h_adv) *h_adv = pen_x - start_x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* x y w h for char at char pos */
|
/* x y w h for char at char pos */
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_common_font_query_char_coords(RGBA_Font *fn, const char *in_text, int pos, int *cx, int *cy, int *cw, int *ch)
|
evas_common_font_query_char_coords(RGBA_Font *fn, const char *text, int pos, int *cx, int *cy, int *cw, int *ch)
|
||||||
{
|
{
|
||||||
int use_kerning;
|
int use_kerning;
|
||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
int prev_chr_end;
|
int prev_chr_end;
|
||||||
int chr;
|
int chr;
|
||||||
int asc, desc;
|
int asc, desc;
|
||||||
int char_index = 0; /* the index of the current char */
|
|
||||||
int position;
|
|
||||||
const char *text = in_text;
|
|
||||||
int ret_val = 0;
|
|
||||||
FT_UInt prev_index;
|
FT_UInt prev_index;
|
||||||
RGBA_Font_Int *fi;
|
RGBA_Font_Int *fi;
|
||||||
FT_Face pface = NULL;
|
FT_Face pface = NULL;
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
int len = 0;
|
|
||||||
EvasIntlParType direction = FRIBIDI_TYPE_ON;
|
|
||||||
EvasIntlLevel *level_list;
|
|
||||||
EvasIntlStrIndex *logical_to_visual;
|
|
||||||
|
|
||||||
char *visual_text = evas_intl_utf8_to_visual(in_text, &len, &direction, &logical_to_visual, NULL, &level_list);
|
|
||||||
text = (visual_text) ? visual_text : in_text;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fi = fn->fonts->data;
|
fi = fn->fonts->data;
|
||||||
|
|
||||||
pen_x = 0;
|
pen_x = 0;
|
||||||
|
@ -263,27 +239,7 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *in_text, int pos,
|
||||||
prev_chr_end = 0;
|
prev_chr_end = 0;
|
||||||
asc = evas_common_font_max_ascent_get(fn);
|
asc = evas_common_font_max_ascent_get(fn);
|
||||||
desc = evas_common_font_max_descent_get(fn);
|
desc = evas_common_font_max_descent_get(fn);
|
||||||
|
for (chr = 0; text[chr];)
|
||||||
/* find the actual index, not the byte position */
|
|
||||||
position = 0;
|
|
||||||
chr = 0;
|
|
||||||
while (in_text[chr] && chr < pos) {
|
|
||||||
evas_common_font_utf8_get_next((unsigned char *)in_text, &chr);
|
|
||||||
position++;
|
|
||||||
}
|
|
||||||
/* if it's a bad position, break */
|
|
||||||
if (chr != pos) goto end;
|
|
||||||
/* if it's the end, the correct position is one after */
|
|
||||||
if (!in_text[chr]) position++;
|
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
/* if it's an in string position (not end), get logical position */
|
|
||||||
if (position < len)
|
|
||||||
position = evas_intl_position_logical_to_visual(logical_to_visual, position);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
for (char_index = 0, chr = 0; text[chr]; char_index++)
|
|
||||||
{
|
{
|
||||||
int pchr;
|
int pchr;
|
||||||
FT_UInt index;
|
FT_UInt index;
|
||||||
|
@ -293,33 +249,16 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *in_text, int pos,
|
||||||
|
|
||||||
pchr = chr;
|
pchr = chr;
|
||||||
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
||||||
|
|
||||||
if (gl == 0) break;
|
if (gl == 0) break;
|
||||||
|
|
||||||
index = evas_common_font_glyph_search(fn, &fi, gl);
|
index = evas_common_font_glyph_search(fn, &fi, gl);
|
||||||
kern = 0;
|
kern = 0;
|
||||||
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
||||||
/* grrr - this means font face sharing is kinda... not an option if */
|
/* grrr - this means font face sharing is kinda... not an option if */
|
||||||
/* you want performance */
|
/* you want performance */
|
||||||
if ((use_kerning) && (prev_index) && (index) &&
|
if ((use_kerning) && (prev_index) && (index) &&
|
||||||
(pface == fi->src->ft.face))
|
(pface == fi->src->ft.face))
|
||||||
{
|
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
pen_x += kern;
|
||||||
/* if it's rtl, the kerning matching should be reversed, i.e prev
|
|
||||||
* index is now the index and the other way around. */
|
|
||||||
if (evas_intl_is_rtl_char(level_list, char_index))
|
|
||||||
{
|
|
||||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pface = fi->src->ft.face;
|
pface = fi->src->ft.face;
|
||||||
fg = evas_common_font_int_cache_glyph_get(fi, index);
|
fg = evas_common_font_int_cache_glyph_get(fi, index);
|
||||||
|
@ -341,171 +280,24 @@ evas_common_font_query_char_coords(RGBA_Font *fn, const char *in_text, int pos,
|
||||||
chr_w += (chr_x - prev_chr_end);
|
chr_w += (chr_x - prev_chr_end);
|
||||||
chr_x = prev_chr_end;
|
chr_x = prev_chr_end;
|
||||||
}
|
}
|
||||||
/* we need to see if the char at the visual position is the char wanted */
|
if (pchr == pos)
|
||||||
if (char_index == position)
|
|
||||||
{
|
{
|
||||||
if (cx) *cx = chr_x;
|
if (cx) *cx = chr_x;
|
||||||
if (cy) *cy = -asc;
|
if (cy) *cy = -asc;
|
||||||
if (cw) *cw = chr_w;
|
if (cw) *cw = chr_w;
|
||||||
if (ch) *ch = asc + desc;
|
if (ch) *ch = asc + desc;
|
||||||
ret_val = 1;
|
return 1;
|
||||||
goto end;
|
|
||||||
}
|
}
|
||||||
prev_chr_end = chr_x + chr_w;
|
prev_chr_end = chr_x + chr_w;
|
||||||
pen_x += fg->glyph->advance.x >> 16;
|
pen_x += fg->glyph->advance.x >> 16;
|
||||||
prev_index = index;
|
prev_index = index;
|
||||||
}
|
}
|
||||||
end:
|
return 0;
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
if (level_list) free(level_list);
|
|
||||||
if (logical_to_visual) free(logical_to_visual);
|
|
||||||
if (visual_text) free(visual_text);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret_val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* char pos of text at xy pos */
|
/* char pos of text at xy pos */
|
||||||
EAPI int
|
EAPI int
|
||||||
evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *in_text, int x, int y, int *cx, int *cy, int *cw, int *ch)
|
evas_common_font_query_text_at_pos(RGBA_Font *fn, const char *text, int x, int y, int *cx, int *cy, int *cw, int *ch)
|
||||||
{
|
|
||||||
int use_kerning;
|
|
||||||
int pen_x, pen_y;
|
|
||||||
int prev_chr_end;
|
|
||||||
int chr;
|
|
||||||
int asc, desc;
|
|
||||||
int char_index = 0; /* the index of the current char */
|
|
||||||
const char *text = in_text;
|
|
||||||
int ret_val = -1;
|
|
||||||
FT_UInt prev_index;
|
|
||||||
RGBA_Font_Int *fi;
|
|
||||||
FT_Face pface = NULL;
|
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
int len = 0;
|
|
||||||
EvasIntlParType direction = FRIBIDI_TYPE_ON;
|
|
||||||
EvasIntlLevel *level_list;
|
|
||||||
EvasIntlStrIndex *visual_to_logical;
|
|
||||||
|
|
||||||
char *visual_text = evas_intl_utf8_to_visual(in_text, &len, &direction, NULL, &visual_to_logical, &level_list);
|
|
||||||
text = (visual_text) ? visual_text : in_text;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fi = fn->fonts->data;
|
|
||||||
|
|
||||||
pen_x = 0;
|
|
||||||
pen_y = 0;
|
|
||||||
evas_common_font_size_use(fn);
|
|
||||||
use_kerning = FT_HAS_KERNING(fi->src->ft.face);
|
|
||||||
prev_index = 0;
|
|
||||||
prev_chr_end = 0;
|
|
||||||
asc = evas_common_font_max_ascent_get(fn);
|
|
||||||
desc = evas_common_font_max_descent_get(fn);
|
|
||||||
|
|
||||||
for (char_index = 0, chr = 0; text[chr]; char_index++)
|
|
||||||
{
|
|
||||||
int pchr;
|
|
||||||
FT_UInt index;
|
|
||||||
RGBA_Font_Glyph *fg;
|
|
||||||
int chr_x, chr_y, chr_w;
|
|
||||||
int gl, kern;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
|
||||||
if (gl == 0) break;
|
|
||||||
index = evas_common_font_glyph_search(fn, &fi, gl);
|
|
||||||
kern = 0;
|
|
||||||
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
|
||||||
/* grrr - this means font face sharing is kinda... not an option if */
|
|
||||||
/* you want performance */
|
|
||||||
if ((use_kerning) && (prev_index) && (index) &&
|
|
||||||
(pface == fi->src->ft.face))
|
|
||||||
{
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
/* if it's rtl, the kerning matching should be reversed, i.e prev
|
|
||||||
* index is now the index and the other way around. */
|
|
||||||
if (evas_intl_is_rtl_char(level_list, char_index))
|
|
||||||
{
|
|
||||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pface = fi->src->ft.face;
|
|
||||||
fg = evas_common_font_int_cache_glyph_get(fi, index);
|
|
||||||
if (!fg) continue;
|
|
||||||
|
|
||||||
if (kern < 0) kern = 0;
|
|
||||||
chr_x = ((pen_x - kern) + (fg->glyph_out->left));
|
|
||||||
chr_y = (pen_y + (fg->glyph_out->top));
|
|
||||||
chr_w = fg->glyph_out->bitmap.width + kern;
|
|
||||||
/* if (text[chr]) */
|
|
||||||
{
|
|
||||||
int advw;
|
|
||||||
|
|
||||||
advw = ((fg->glyph->advance.x + (kern << 16)) >> 16);
|
|
||||||
if (chr_w < advw) chr_w = advw;
|
|
||||||
}
|
|
||||||
if (chr_x > prev_chr_end)
|
|
||||||
{
|
|
||||||
chr_w += (chr_x - prev_chr_end);
|
|
||||||
chr_x = prev_chr_end;
|
|
||||||
}
|
|
||||||
if ((x >= chr_x) && (x <= (chr_x + chr_w)) &&
|
|
||||||
(y >= -asc) && (y <= desc))
|
|
||||||
{
|
|
||||||
if (cx) *cx = chr_x;
|
|
||||||
if (cy) *cy = -asc;
|
|
||||||
if (cw) *cw = chr_w;
|
|
||||||
if (ch) *ch = asc + desc;
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int logical_chr;
|
|
||||||
int position = evas_intl_position_visual_to_logical(visual_to_logical, char_index);
|
|
||||||
|
|
||||||
|
|
||||||
/* ensure even if the list won't run */
|
|
||||||
pchr = 0;
|
|
||||||
for (logical_chr = 0, i = 0; i <= position; i++) {
|
|
||||||
pchr = logical_chr;
|
|
||||||
evas_common_font_utf8_get_next((unsigned char *)in_text, &logical_chr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret_val = pchr;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
prev_chr_end = chr_x + chr_w;
|
|
||||||
pen_x += fg->glyph->advance.x >> 16;
|
|
||||||
prev_index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
if (level_list) free(level_list);
|
|
||||||
if (visual_to_logical) free(visual_to_logical);
|
|
||||||
if (visual_text) free(visual_text);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* last char pos of text at xy pos
|
|
||||||
* Note: no need for special rtl handling
|
|
||||||
* because the string is in logical order, which is correct */
|
|
||||||
EAPI int
|
|
||||||
evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const char *text, int x, int y)
|
|
||||||
{
|
{
|
||||||
int use_kerning;
|
int use_kerning;
|
||||||
int pen_x, pen_y;
|
int pen_x, pen_y;
|
||||||
|
@ -570,6 +362,10 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const char *text, int x, in
|
||||||
if ((x >= chr_x) && (x <= (chr_x + chr_w)) &&
|
if ((x >= chr_x) && (x <= (chr_x + chr_w)) &&
|
||||||
(y >= -asc) && (y <= desc))
|
(y >= -asc) && (y <= desc))
|
||||||
{
|
{
|
||||||
|
if (cx) *cx = chr_x;
|
||||||
|
if (cy) *cy = -asc;
|
||||||
|
if (cw) *cw = chr_w;
|
||||||
|
if (ch) *ch = asc + desc;
|
||||||
return pchr;
|
return pchr;
|
||||||
}
|
}
|
||||||
prev_chr_end = chr_x + chr_w;
|
prev_chr_end = chr_x + chr_w;
|
||||||
|
@ -578,137 +374,3 @@ evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const char *text, int x, in
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
/* last char pos of text at xy pos */
|
|
||||||
EAPI int
|
|
||||||
evas_common_font_query_last_up_to_pos(RGBA_Font *fn, const char *in_text, int x, int y)
|
|
||||||
{
|
|
||||||
int use_kerning;
|
|
||||||
int pen_x, pen_y;
|
|
||||||
int prev_chr_end;
|
|
||||||
int chr;
|
|
||||||
int asc, desc;
|
|
||||||
int char_index = 0; /* the index of the current char */
|
|
||||||
const char *text = in_text;
|
|
||||||
int ret_val = -1;
|
|
||||||
FT_UInt prev_index;
|
|
||||||
RGBA_Font_Int *fi;
|
|
||||||
FT_Face pface = NULL;
|
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
int len = 0;
|
|
||||||
EvasIntlParType direction = FRIBIDI_TYPE_ON;
|
|
||||||
EvasIntlLevel *level_list;
|
|
||||||
EvasIntlStrIndex *visual_to_logical;
|
|
||||||
|
|
||||||
char *visual_text = evas_intl_utf8_to_visual(in_text, &len, &direction, NULL, &visual_to_logical, &level_list);
|
|
||||||
text = (visual_text) ? visual_text : in_text;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
fi = fn->fonts->data;
|
|
||||||
|
|
||||||
pen_x = 0;
|
|
||||||
pen_y = 0;
|
|
||||||
evas_common_font_size_use(fn);
|
|
||||||
use_kerning = FT_HAS_KERNING(fi->src->ft.face);
|
|
||||||
prev_index = 0;
|
|
||||||
prev_chr_end = 0;
|
|
||||||
asc = evas_common_font_max_ascent_get(fn);
|
|
||||||
desc = evas_common_font_max_descent_get(fn);
|
|
||||||
|
|
||||||
for (char_index = 0, chr = 0; text[chr]; char_index++)
|
|
||||||
{
|
|
||||||
int pchr;
|
|
||||||
FT_UInt index;
|
|
||||||
RGBA_Font_Glyph *fg;
|
|
||||||
int chr_x, chr_y, chr_w;
|
|
||||||
int gl, kern;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gl = evas_common_font_utf8_get_next((unsigned char *)text, &chr);
|
|
||||||
if (gl == 0) break;
|
|
||||||
index = evas_common_font_glyph_search(fn, &fi, gl);
|
|
||||||
kern = 0;
|
|
||||||
/* hmmm kerning means i can't sanely do my own cached metric tables! */
|
|
||||||
/* grrr - this means font face sharing is kinda... not an option if */
|
|
||||||
/* you want performance */
|
|
||||||
if ((use_kerning) && (prev_index) && (index) &&
|
|
||||||
(pface == fi->src->ft.face))
|
|
||||||
{
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
/* if it's rtl, the kerning matching should be reversed, i.e prev
|
|
||||||
* index is now the index and the other way around. */
|
|
||||||
if (evas_intl_is_rtl_char(level_list, char_index))
|
|
||||||
{
|
|
||||||
if (evas_common_font_query_kerning(fi, index, prev_index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
if (evas_common_font_query_kerning(fi, prev_index, index, &kern))
|
|
||||||
pen_x += kern;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pface = fi->src->ft.face;
|
|
||||||
fg = evas_common_font_int_cache_glyph_get(fi, index);
|
|
||||||
if (!fg) continue;
|
|
||||||
|
|
||||||
if (kern < 0) kern = 0;
|
|
||||||
chr_x = ((pen_x - kern) + (fg->glyph_out->left));
|
|
||||||
chr_y = (pen_y + (fg->glyph_out->top));
|
|
||||||
chr_w = fg->glyph_out->bitmap.width + kern;
|
|
||||||
/* if (text[chr]) */
|
|
||||||
{
|
|
||||||
int advw;
|
|
||||||
|
|
||||||
advw = ((fg->glyph->advance.x + (kern << 16)) >> 16);
|
|
||||||
if (chr_w < advw) chr_w = advw;
|
|
||||||
}
|
|
||||||
if (chr_x > prev_chr_end)
|
|
||||||
{
|
|
||||||
chr_w += (chr_x - prev_chr_end);
|
|
||||||
chr_x = prev_chr_end;
|
|
||||||
}
|
|
||||||
if ((x >= chr_x) && (x <= (chr_x + chr_w)) &&
|
|
||||||
(y >= -asc) && (y <= desc))
|
|
||||||
{
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
{
|
|
||||||
/* returs the char at the same position as the char found,
|
|
||||||
* though in the logical string which ensures it's the last
|
|
||||||
*/
|
|
||||||
int i;
|
|
||||||
int logical_chr;
|
|
||||||
|
|
||||||
/* ensure even if the list won't run */
|
|
||||||
pchr = 0;
|
|
||||||
for (logical_chr = 0, i = 0; i <= char_index; i++) {
|
|
||||||
pchr = logical_chr;
|
|
||||||
evas_common_font_utf8_get_next((unsigned char *)in_text, &logical_chr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret_val = pchr;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
prev_chr_end = chr_x + chr_w;
|
|
||||||
pen_x += fg->glyph->advance.x >> 16;
|
|
||||||
prev_index = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
|
||||||
if (level_list) free(level_list);
|
|
||||||
if (visual_to_logical) free(visual_to_logical);
|
|
||||||
if (visual_text) free(visual_text);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ret_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
/* Authors:
|
||||||
|
* Tom Hacohen (tom@stsob.com)
|
||||||
|
*/
|
||||||
|
|
||||||
#include "../evas_intl_utils.h"
|
#include "../evas_intl_utils.h"
|
||||||
|
|
||||||
#ifdef ARABIC_SUPPORT
|
#ifdef ARABIC_SUPPORT
|
||||||
|
@ -114,7 +118,7 @@ evas_intl_arabic_to_context(FriBidiChar *text)
|
||||||
|
|
||||||
/* check for empty string */
|
/* check for empty string */
|
||||||
if (!*text)
|
if (!*text)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
len = _evas_intl_arabic_text_to_isolated(text);
|
len = _evas_intl_arabic_text_to_isolated(text);
|
||||||
/*FIXME: make it skip vowels */
|
/*FIXME: make it skip vowels */
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
#ifndef _EVAS_INTL_ARABIC
|
#ifndef _EVAS_INTL_ARABIC
|
||||||
#define _EVAS_INTL_ARABIC
|
#define _EVAS_INTL_ARABIC
|
||||||
|
|
||||||
#include "evas_intl_utils.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
evas_intl_arabic_to_context(EvasIntlChar *text);
|
evas_intl_arabic_to_context(FriBidiChar *text);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,27 +1,23 @@
|
||||||
|
/* Authors:
|
||||||
|
* Tom Hacohen (tom@stsob.com)
|
||||||
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "evas_common.h"
|
#include "evas_common.h"
|
||||||
#include "evas_intl_utils.h"
|
#include "evas_intl_utils.h"
|
||||||
|
|
||||||
#ifdef INTERNATIONAL_SUPPORT
|
#ifdef USE_FRIBIDI
|
||||||
#include <fribidi/fribidi.h>
|
#include <fribidi/fribidi.h>
|
||||||
|
|
||||||
#define UTF8_BYTES_PER_CHAR 4
|
#define UTF8_BYTES_PER_CHAR 4
|
||||||
|
|
||||||
/* FIXME: fribidi_utf8_to_unicode should use char len and not byte len!*/
|
/* FIXME: fribidi_utf8_to_unicode should use char len and not byte len!*/
|
||||||
char *
|
char *
|
||||||
evas_intl_utf8_to_visual(const char *text,
|
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction, FriBidiLevel **embedding_level_list)
|
||||||
int *ret_len,
|
|
||||||
EvasIntlParType *direction,
|
|
||||||
EvasIntlStrIndex **position_L_to_V_list,
|
|
||||||
EvasIntlStrIndex **position_V_to_L_list,
|
|
||||||
EvasIntlLevel **embedding_level_list)
|
|
||||||
{
|
{
|
||||||
FriBidiChar *unicode_in, *unicode_out;
|
FriBidiChar *unicode_in, *unicode_out;
|
||||||
EvasIntlStrIndex *tmp_L_to_V_list = NULL;
|
|
||||||
EvasIntlStrIndex *tmp_V_to_L_list = NULL;
|
|
||||||
EvasIntlLevel *tmp_level_list = NULL;
|
|
||||||
char *text_out;
|
char *text_out;
|
||||||
size_t len;
|
size_t len;
|
||||||
size_t byte_len;
|
size_t byte_len;
|
||||||
|
@ -31,6 +27,15 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
|
|
||||||
len = evas_string_char_len_get(text);
|
len = evas_string_char_len_get(text);
|
||||||
|
|
||||||
|
/* if there's nothing to do, return text
|
||||||
|
* one char draws are quite common */
|
||||||
|
if (len <= 1)
|
||||||
|
{
|
||||||
|
*ret_len = len;
|
||||||
|
*embedding_level_list = NULL;
|
||||||
|
return strdup(text);
|
||||||
|
}
|
||||||
|
|
||||||
byte_len = strlen(text); /* we need the actual number of bytes, not number of chars */
|
byte_len = strlen(text); /* we need the actual number of bytes, not number of chars */
|
||||||
|
|
||||||
unicode_in = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
unicode_in = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
||||||
|
@ -45,59 +50,33 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
unicode_out = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
unicode_out = (FriBidiChar *)malloc(sizeof(FriBidiChar) * (len + 1));
|
||||||
if (!unicode_out)
|
if (!unicode_out)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -2;
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (embedding_level_list)
|
*embedding_level_list = (FriBidiLevel *)malloc(sizeof(FriBidiLevel) * len);
|
||||||
{
|
if (!*embedding_level_list)
|
||||||
*embedding_level_list = (EvasIntlLevel *)malloc(sizeof(EvasIntlLevel) * len);
|
{
|
||||||
if (!*embedding_level_list)
|
len = -3;
|
||||||
{
|
goto error3;
|
||||||
len = -1;
|
}
|
||||||
goto error3;
|
|
||||||
}
|
|
||||||
tmp_level_list = *embedding_level_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position_L_to_V_list)
|
|
||||||
{
|
|
||||||
*position_L_to_V_list = (EvasIntlStrIndex *)malloc(sizeof(EvasIntlStrIndex) * len);
|
|
||||||
if (!*position_L_to_V_list)
|
|
||||||
{
|
|
||||||
len = -1;
|
|
||||||
goto error4;
|
|
||||||
}
|
|
||||||
tmp_L_to_V_list = *position_L_to_V_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position_V_to_L_list)
|
|
||||||
{
|
|
||||||
*position_V_to_L_list = (EvasIntlStrIndex *)malloc(sizeof(EvasIntlStrIndex) * len);
|
|
||||||
if (!*position_V_to_L_list)
|
|
||||||
{
|
|
||||||
len = -1;
|
|
||||||
goto error5;
|
|
||||||
}
|
|
||||||
tmp_V_to_L_list = *position_V_to_L_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ARABIC_SUPPORT
|
#ifdef ARABIC_SUPPORT
|
||||||
/* fix arabic context */
|
/* fix arabic context */
|
||||||
evas_intl_arabic_to_context(unicode_in);
|
evas_intl_arabic_to_context(unicode_in);
|
||||||
#endif
|
#endif
|
||||||
if (!fribidi_log2vis(unicode_in, len, direction,
|
if (!fribidi_log2vis(unicode_in, len, direction,
|
||||||
unicode_out, tmp_L_to_V_list, tmp_V_to_L_list, tmp_level_list))
|
unicode_out, NULL, NULL, *embedding_level_list))
|
||||||
{
|
{
|
||||||
len = -2;
|
len = -4;
|
||||||
goto error5;
|
goto error3;
|
||||||
}
|
}
|
||||||
|
|
||||||
text_out = malloc(UTF8_BYTES_PER_CHAR * len + 1);
|
text_out = malloc(UTF8_BYTES_PER_CHAR * len + 1);
|
||||||
if (!text_out)
|
if (!text_out)
|
||||||
{
|
{
|
||||||
len = -1;
|
len = -5;
|
||||||
goto error6;
|
goto error4;
|
||||||
}
|
}
|
||||||
|
|
||||||
fribidi_unicode_to_utf8(unicode_out, len, text_out);
|
fribidi_unicode_to_utf8(unicode_out, len, text_out);
|
||||||
|
@ -109,17 +88,10 @@ evas_intl_utf8_to_visual(const char *text,
|
||||||
return text_out;
|
return text_out;
|
||||||
|
|
||||||
/* ERROR HANDLING */
|
/* ERROR HANDLING */
|
||||||
error6:
|
|
||||||
free(unicode_out);
|
|
||||||
error5:
|
|
||||||
free(*position_V_to_L_list);
|
|
||||||
*position_V_to_L_list = NULL;
|
|
||||||
error4:
|
error4:
|
||||||
free(*position_L_to_V_list);
|
free(unicode_out);
|
||||||
*position_L_to_V_list = NULL;
|
|
||||||
error3:
|
error3:
|
||||||
free(*embedding_level_list);
|
free(*embedding_level_list);
|
||||||
*embedding_level_list = NULL;
|
|
||||||
error2:
|
error2:
|
||||||
free(unicode_in);
|
free(unicode_in);
|
||||||
error1:
|
error1:
|
||||||
|
@ -129,7 +101,7 @@ error1:
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
evas_intl_is_rtl_char(EvasIntlLevel *embedded_level_list, EvasIntlStrIndex i)
|
evas_intl_is_rtl_char(FriBidiLevel *embedded_level_list, FriBidiStrIndex i)
|
||||||
{
|
{
|
||||||
if(embedded_level_list || i < 0)
|
if(embedded_level_list || i < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -4,44 +4,25 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef HAVE_FRIBIDI
|
#ifdef HAVE_FRIBIDI
|
||||||
#define USE_FRIBIDI
|
#define USE_FRIBIDI 1
|
||||||
#define INTERNATIONAL_SUPPORT
|
#define INTERNATIONAL_SUPPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_FRIBIDI
|
#ifdef USE_FRIBIDI
|
||||||
#include <fribidi/fribidi.h>
|
#include <fribidi/fribidi.h>
|
||||||
|
|
||||||
/* abstract fribidi */
|
|
||||||
typedef FriBidiChar EvasIntlChar;
|
|
||||||
typedef FriBidiCharType EvasIntlParType;
|
|
||||||
typedef FriBidiStrIndex EvasIntlStrIndex;
|
|
||||||
typedef FriBidiLevel EvasIntlLevel;
|
|
||||||
|
|
||||||
|
|
||||||
/* whether should fix arabic specifix issues */
|
/* whether should fix arabic specifix issues */
|
||||||
#define ARABIC_SUPPORT
|
#define ARABIC_SUPPORT 1
|
||||||
|
|
||||||
#ifdef ARABIC_SUPPORT
|
#ifdef ARABIC_SUPPORT
|
||||||
#include "evas_intl/evas_intl_arabic.h"
|
#include "evas_intl/evas_intl_arabic.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define evas_intl_position_logical_to_visual(list, position) \
|
|
||||||
(list) ? list[position] : position;
|
|
||||||
|
|
||||||
#define evas_intl_position_visual_to_logical(list, position) \
|
|
||||||
(list) ? list[position] : position;
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
evas_intl_is_rtl_char(EvasIntlLevel *embedded_level_list, EvasIntlStrIndex i);
|
evas_intl_is_rtl_char(FriBidiLevel *embedded_level_list, FriBidiStrIndex i);
|
||||||
|
|
||||||
char *
|
char *
|
||||||
evas_intl_utf8_to_visual(const char *text,
|
evas_intl_utf8_to_visual(const char *text, int *ret_len, FriBidiCharType *direction, FriBidiLevel **embedding_level_list);
|
||||||
int *ret_len,
|
|
||||||
EvasIntlParType *direction,
|
|
||||||
EvasIntlStrIndex **position_L_to_V_list,
|
|
||||||
EvasIntlStrIndex **position_V_to_L_list,
|
|
||||||
EvasIntlLevel **embedding_level_list);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -684,7 +684,6 @@ struct _Evas_Func
|
||||||
|
|
||||||
void (*image_scale_hint_set) (void *data, void *image, int hint);
|
void (*image_scale_hint_set) (void *data, void *image, int hint);
|
||||||
int (*image_scale_hint_get) (void *data, void *image);
|
int (*image_scale_hint_get) (void *data, void *image);
|
||||||
int (*font_last_up_to_pos) (void *data, void *font, const char *text, int x, int y);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Evas_Image_Load_Func
|
struct _Evas_Image_Load_Func
|
||||||
|
|
Loading…
Reference in New Issue