evas: switch font backend function to rely on engine instead of output.

This commit is contained in:
Cedric BAIL 2017-08-25 10:51:24 -07:00
parent 7bcf483d6f
commit ef55155e0e
4 changed files with 45 additions and 45 deletions

View File

@ -163,7 +163,7 @@ _evas_object_text_char_coords_get(const Evas_Object *eo_obj,
(pos < (it->text_pos + it->text_props.text_len))) (pos < (it->text_pos + it->text_props.text_len)))
{ {
int ret; int ret;
ret = ENFN->font_char_coords_get(ENDT, o->font, ret = ENFN->font_char_coords_get(ENC, o->font,
&it->text_props, pos - it->text_pos, x, y, w, h); &it->text_props, pos - it->text_pos, x, y, w, h);
if (x) *x += it->x; if (x) *x += it->x;
return ret; return ret;
@ -304,7 +304,7 @@ _evas_object_text_last_up_to_pos(const Evas_Object *eo_obj,
{ {
if ((x <= cx) && (cx < x + it->adv)) if ((x <= cx) && (cx < x + it->adv))
{ {
pos = it->text_pos + ENFN->font_last_up_to_pos(ENDT, pos = it->text_pos + ENFN->font_last_up_to_pos(ENC,
o->font, o->font,
&it->text_props, &it->text_props,
cx - x, cx - x,
@ -322,7 +322,7 @@ _evas_object_text_last_up_to_pos(const Evas_Object *eo_obj,
{ {
if ((it->x <= cx) && (cx < it->x + it->adv)) if ((it->x <= cx) && (cx < it->x + it->adv))
{ {
return it->text_pos + ENFN->font_last_up_to_pos(ENDT, return it->text_pos + ENFN->font_last_up_to_pos(ENC,
o->font, o->font,
&it->text_props, &it->text_props,
cx - it->x, cx - it->x,
@ -345,7 +345,7 @@ _evas_object_text_char_at_coords(const Evas_Object *eo_obj,
{ {
if ((it->x <= cx) && (cx < it->x + it->adv)) if ((it->x <= cx) && (cx < it->x + it->adv))
{ {
return it->text_pos + ENFN->font_char_at_coords_get(ENDT, return it->text_pos + ENFN->font_char_at_coords_get(ENC,
o->font, o->font,
&it->text_props, &it->text_props,
cx - it->x, cx - it->x,
@ -504,11 +504,11 @@ _evas_text_efl_text_properties_font_get(Eo *eo_obj EINA_UNUSED, Evas_Text_Data *
static void static void
_evas_object_text_item_update_sizes(Evas_Object_Protected_Data *obj, Evas_Text_Data *o, Evas_Object_Text_Item *it) _evas_object_text_item_update_sizes(Evas_Object_Protected_Data *obj, Evas_Text_Data *o, Evas_Object_Text_Item *it)
{ {
ENFN->font_string_size_get(ENDT, ENFN->font_string_size_get(ENC,
o->font, o->font,
&it->text_props, &it->text_props,
&it->w, &it->h); &it->w, &it->h);
it->adv = ENFN->font_h_advance_get(ENDT, o->font, it->adv = ENFN->font_h_advance_get(ENC, o->font,
&it->text_props); &it->text_props);
} }
@ -538,7 +538,7 @@ _evas_object_text_item_new(Evas_Object_Protected_Data *obj,
if (fi) if (fi)
{ {
ENFN->font_text_props_info_create(ENDT, ENFN->font_text_props_info_create(ENC,
fi, str + pos, &it->text_props, fi, str + pos, &it->text_props,
o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE, o->bidi_par_props, it->text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
o->cur.fdesc->lang); o->cur.fdesc->lang);
@ -619,7 +619,7 @@ _layout_ellipsis_item_new(Evas_Object_Protected_Data *obj, Evas_Text_Data *o)
if (o->font) if (o->font)
{ {
(void) ENFN->font_run_end_get(ENDT, o->font, &script_fi, &cur_fi, (void) ENFN->font_run_end_get(ENC, o->font, &script_fi, &cur_fi,
script, _ellip_str, 1); script, _ellip_str, 1);
ellip_ti = _evas_object_text_item_new(obj, o, cur_fi, ellip_ti = _evas_object_text_item_new(obj, o, cur_fi,
_ellip_str, script, 0, 0, len); _ellip_str, script, 0, 0, len);
@ -780,7 +780,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
if (o->font) if (o->font)
{ {
run_len = ENFN->font_run_end_get run_len = ENFN->font_run_end_get
(ENDT, o->font, &script_fi, &cur_fi, (ENC, o->font, &script_fi, &cur_fi,
script, text + pos, script_len); script, text + pos, script_len);
} }
#ifdef BIDI_SUPPORT #ifdef BIDI_SUPPORT
@ -887,7 +887,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
} }
if (itr && (itr != start_ellip_it)) if (itr && (itr != start_ellip_it))
{ {
int cut = ENFN->font_last_up_to_pos(ENDT, int cut = ENFN->font_last_up_to_pos(ENC,
o->font, o->font,
&itr->text_props, &itr->text_props,
ellipsis_coord - (advance + l + r), ellipsis_coord - (advance + l + r),
@ -942,7 +942,7 @@ _evas_object_text_layout(Evas_Object *eo_obj, Evas_Text_Data *o, Eina_Unicode *t
int cut = -1; int cut = -1;
if (itr && (itr != end_ellip_it)) if (itr && (itr != end_ellip_it))
{ {
cut = ENFN->font_last_up_to_pos(ENDT, cut = ENFN->font_last_up_to_pos(ENC,
o->font, o->font,
&itr->text_props, &itr->text_props,
ellip_frame - (advance + l + r), ellip_frame - (advance + l + r),
@ -1177,7 +1177,7 @@ _evas_text_inset_get(Eo *eo_obj, Evas_Text_Data *o)
Evas_Coord inset = 0; Evas_Coord inset = 0;
if (!o->font) return inset; if (!o->font) return inset;
if (!o->items) return inset; if (!o->items) return inset;
inset = ENFN->font_inset_get(ENDT, o->font, &o->items->text_props); inset = ENFN->font_inset_get(ENC, o->font, &o->items->text_props);
return inset; return inset;
} }
@ -2286,18 +2286,18 @@ _evas_object_text_recalc(Evas_Object *eo_obj, Eina_Unicode *text)
*/ */
if (o->font) if (o->font)
{ {
o->ascent = ENFN->font_ascent_get(ENDT, o->font); o->ascent = ENFN->font_ascent_get(ENC, o->font);
o->descent = ENFN->font_descent_get(ENDT, o->font); o->descent = ENFN->font_descent_get(ENC, o->font);
o->max_ascent = ENFN->font_max_ascent_get(ENDT, o->font); o->max_ascent = ENFN->font_max_ascent_get(ENC, o->font);
o->max_descent = ENFN->font_max_descent_get(ENDT, o->font); o->max_descent = ENFN->font_max_descent_get(ENC, o->font);
} }
} }
else if (o->font) else if (o->font)
{ {
o->ascent = ENFN->font_ascent_get(ENDT, o->font); o->ascent = ENFN->font_ascent_get(ENC, o->font);
o->descent = ENFN->font_descent_get(ENDT, o->font); o->descent = ENFN->font_descent_get(ENC, o->font);
o->max_ascent = ENFN->font_max_ascent_get(ENDT, o->font); o->max_ascent = ENFN->font_max_ascent_get(ENC, o->font);
o->max_descent = ENFN->font_max_descent_get(ENDT, o->font); o->max_descent = ENFN->font_max_descent_get(ENC, o->font);
} }
if ((o->font) && (o->items)) if ((o->font) && (o->items))

View File

@ -2956,7 +2956,7 @@ _layout_item_max_ascent_descent_calc(Evas_Object_Protected_Data *obj,
} }
else else
{ {
asc = ENFN->font_max_ascent_get(ENDT, asc = ENFN->font_max_ascent_get(ENC,
it->format->font.font); it->format->font.font);
} }
@ -2976,7 +2976,7 @@ _layout_item_max_ascent_descent_calc(Evas_Object_Protected_Data *obj,
} }
else else
{ {
desc = ENFN->font_max_descent_get(ENDT, desc = ENFN->font_max_descent_get(ENC,
it->format->font.font); it->format->font.font);
} }
@ -3027,8 +3027,8 @@ _layout_item_ascent_descent_adjust(Evas_Object_Protected_Data *obj,
{ {
if (fmt) if (fmt)
{ {
asc = ENFN->font_ascent_get(ENDT, fmt->font.font); asc = ENFN->font_ascent_get(ENC, fmt->font.font);
desc = ENFN->font_descent_get(ENDT, fmt->font.font); desc = ENFN->font_descent_get(ENC, fmt->font.font);
} }
} }
if (fmt) _layout_format_ascent_descent_adjust(obj, &asc, &desc, fmt); if (fmt) _layout_format_ascent_descent_adjust(obj, &asc, &desc, fmt);
@ -4005,7 +4005,7 @@ _layout_text_cutoff_get(Ctxt *c, Evas_Object_Textblock_Format *fmt,
c->marginr - from_x - ti->x_adjustment; c->marginr - from_x - ti->x_adjustment;
if (x < 0) if (x < 0)
x = 0; x = 0;
return ENFN->font_last_up_to_pos(ENDT, fmt->font.font, return ENFN->font_last_up_to_pos(ENC, fmt->font.font,
&ti->text_props, x, 0, width_offset); &ti->text_props, x, 0, width_offset);
} }
return -1; return -1;
@ -4116,9 +4116,9 @@ _text_item_update_sizes(Ctxt *c, Evas_Object_Textblock_Text_Item *ti)
if (fmt->font.font) if (fmt->font.font)
{ {
ENFN->font_string_size_get(ENDT, fmt->font.font, ENFN->font_string_size_get(ENC, fmt->font.font,
&ti->text_props, &tw, &th); &ti->text_props, &tw, &th);
advw = ENFN->font_h_advance_get(ENDT, fmt->font.font, advw = ENFN->font_h_advance_get(ENC, fmt->font.font,
&ti->text_props); &ti->text_props);
} }
@ -4371,7 +4371,7 @@ skip:
if (ti->parent.format->font.font) if (ti->parent.format->font.font)
{ {
run_len = ENFN->font_run_end_get(ENDT, run_len = ENFN->font_run_end_get(ENC,
ti->parent.format->font.font, &script_fi, &cur_fi, ti->parent.format->font.font, &script_fi, &cur_fi,
script, str, script_len); script, str, script_len);
} }
@ -4382,7 +4382,7 @@ skip:
if (cur_fi) if (cur_fi)
{ {
ENFN->font_text_props_info_create(ENDT, ENFN->font_text_props_info_create(ENC,
cur_fi, str, &ti->text_props, c->par->bidi_props, cur_fi, str, &ti->text_props, c->par->bidi_props,
ti->parent.text_pos, run_len, EVAS_TEXT_PROPS_MODE_SHAPE, ti->parent.text_pos, run_len, EVAS_TEXT_PROPS_MODE_SHAPE,
ti->parent.format->font.fdesc->lang); ti->parent.format->font.fdesc->lang);
@ -5131,11 +5131,11 @@ _layout_ellipsis_item_new(Ctxt *c, const Evas_Object_Textblock_Item *cur_it)
{ {
Evas_Object_Protected_Data *obj = c->evas_o; Evas_Object_Protected_Data *obj = c->evas_o;
/* It's only 1 char anyway, we don't need the run end. */ /* It's only 1 char anyway, we don't need the run end. */
(void) ENFN->font_run_end_get(ENDT, (void) ENFN->font_run_end_get(ENC,
ellip_ti->parent.format->font.font, &script_fi, &cur_fi, ellip_ti->parent.format->font.font, &script_fi, &cur_fi,
script, _ellip_str, len); script, _ellip_str, len);
ENFN->font_text_props_info_create(ENDT, ENFN->font_text_props_info_create(ENC,
cur_fi, _ellip_str, &ellip_ti->text_props, cur_fi, _ellip_str, &ellip_ti->text_props,
c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE, c->par->bidi_props, ellip_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
ellip_ti->parent.format->font.fdesc->lang); ellip_ti->parent.format->font.fdesc->lang);
@ -5335,7 +5335,7 @@ _item_get_cutoff(Ctxt *c, Evas_Object_Textblock_Item *it, Evas_Coord x, Evas_Coo
ti = (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(it) : NULL; ti = (it->type == EVAS_TEXTBLOCK_ITEM_TEXT) ? _ITEM_TEXT(it) : NULL;
if (ti && ti->parent.format->font.font) if (ti && ti->parent.format->font.font)
{ {
pos = ENFN->font_last_up_to_pos(ENDT, ti->parent.format->font.font, pos = ENFN->font_last_up_to_pos(ENC, ti->parent.format->font.font,
&ti->text_props, x, 0, width_offset); &ti->text_props, x, 0, width_offset);
} }
return pos; return pos;
@ -8109,11 +8109,11 @@ _layout_hyphen_item_new(Ctxt *c, const Evas_Object_Textblock_Text_Item *cur_ti)
{ {
Evas_Object_Protected_Data *obj = c->evas_o; Evas_Object_Protected_Data *obj = c->evas_o;
/* It's only 1 char anyway, we don't need the run end. */ /* It's only 1 char anyway, we don't need the run end. */
(void) ENFN->font_run_end_get(ENDT, (void) ENFN->font_run_end_get(ENC,
hyphen_ti->parent.format->font.font, &script_fi, &cur_fi, hyphen_ti->parent.format->font.font, &script_fi, &cur_fi,
script, _hyphen_str, len); script, _hyphen_str, len);
ENFN->font_text_props_info_create(ENDT, ENFN->font_text_props_info_create(ENC,
cur_fi, _hyphen_str, &hyphen_ti->text_props, cur_fi, _hyphen_str, &hyphen_ti->text_props,
c->par->bidi_props, hyphen_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE, c->par->bidi_props, hyphen_ti->parent.text_pos, len, EVAS_TEXT_PROPS_MODE_SHAPE,
hyphen_ti->parent.format->font.fdesc->lang); hyphen_ti->parent.format->font.fdesc->lang);
@ -11533,7 +11533,7 @@ _evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *dat
if (ti->parent.format->font.font) if (ti->parent.format->font.font)
{ {
Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS); Evas_Object_Protected_Data *obj = efl_data_scope_get(cur->obj, EFL_CANVAS_OBJECT_CLASS);
query_func(ENDT, query_func(ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
pos, pos,
@ -11749,7 +11749,7 @@ evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x,
pos = -1; pos = -1;
if (ti->parent.format->font.font) if (ti->parent.format->font.font)
pos = ENFN->font_char_at_coords_get( pos = ENFN->font_char_at_coords_get(
ENDT, ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
x - it->x - ln->x, 0, x - it->x - ln->x, 0,
@ -12025,7 +12025,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
ti = _ITEM_TEXT(it1); ti = _ITEM_TEXT(it1);
if (ti->parent.format->font.font) if (ti->parent.format->font.font)
{ {
ret = ENFN->font_pen_coords_get(ENDT, ret = ENFN->font_pen_coords_get(ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
start, start,
@ -12035,7 +12035,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
{ {
return NULL; return NULL;
} }
ret = ENFN->font_pen_coords_get(ENDT, ret = ENFN->font_pen_coords_get(ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
end, end,
@ -12107,7 +12107,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
int ret; int ret;
ti = _ITEM_TEXT(it1); ti = _ITEM_TEXT(it1);
ret = ENFN->font_pen_coords_get(ENDT, ret = ENFN->font_pen_coords_get(ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
start, start,
@ -12165,7 +12165,7 @@ _evas_textblock_cursor_range_in_line_geometry_get(
int ret; int ret;
ti = _ITEM_TEXT(it2); ti = _ITEM_TEXT(it2);
ret = ENFN->font_pen_coords_get(ENDT, ret = ENFN->font_pen_coords_get(ENC,
ti->parent.format->font.font, ti->parent.format->font.font,
&ti->text_props, &ti->text_props,
end, end,

View File

@ -346,11 +346,11 @@ evas_object_textgrid_row_text_append(Evas_Object_Textgrid_Row *row,
text->bold = is_bold; text->bold = is_bold;
text->italic = is_italic; text->italic = is_italic;
font = _textgrid_font_get(o, is_bold, is_italic); font = _textgrid_font_get(o, is_bold, is_italic);
ENFN->font_run_end_get(ENDT, font, &script_fi, &cur_fi, ENFN->font_run_end_get(ENC, font, &script_fi, &cur_fi,
script, &codepoint, 1); script, &codepoint, 1);
memset(&(text->text_props), 0, sizeof(Evas_Text_Props)); memset(&(text->text_props), 0, sizeof(Evas_Text_Props));
evas_common_text_props_script_set(&(text->text_props), script); evas_common_text_props_script_set(&(text->text_props), script);
ENFN->font_text_props_info_create(ENDT, script_fi, &codepoint, ENFN->font_text_props_info_create(ENC, script_fi, &codepoint,
&(text->text_props), NULL, 0, 1, &(text->text_props), NULL, 0, 1,
EVAS_TEXT_PROPS_MODE_NONE, EVAS_TEXT_PROPS_MODE_NONE,
o->cur.font_description_normal->lang); o->cur.font_description_normal->lang);

View File

@ -1377,7 +1377,7 @@ eng_font_cache_flush(void *engine)
{ {
int tmp_size; int tmp_size;
gl_generic_window_use(engine); gl_generic_window_find(engine);
tmp_size = evas_common_font_cache_get(); tmp_size = evas_common_font_cache_get();
evas_common_font_cache_set(0); evas_common_font_cache_set(0);
evas_common_font_flush(); evas_common_font_flush();
@ -1387,14 +1387,14 @@ eng_font_cache_flush(void *engine)
static void static void
eng_font_cache_set(void *engine, int bytes) eng_font_cache_set(void *engine, int bytes)
{ {
gl_generic_window_use(engine); gl_generic_window_find(engine);
evas_common_font_cache_set(bytes); evas_common_font_cache_set(bytes);
} }
static int static int
eng_font_cache_get(void *engine) eng_font_cache_get(void *engine)
{ {
gl_generic_window_use(engine); gl_generic_window_find(engine);
return evas_common_font_cache_get(); return evas_common_font_cache_get();
} }