From: Tom Hacohen Date: Thu, 10 Feb 2011 09:03:14 +0000 (+0000) Subject: Evas font-engine: Fixed inset to use the string objects instead of strings. X-Git-Tag: submit/devel/efl/20131022.203902~10472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e68ec8b427f1ffb1bb7a6c2e698250b76112105;p=platform%2Fupstream%2Fefl.git Evas font-engine: Fixed inset to use the string objects instead of strings. SVN revision: 56895 --- diff --git a/legacy/evas/src/lib/canvas/evas_object_text.c b/legacy/evas/src/lib/canvas/evas_object_text.c index 38f6d70..f823c7d 100644 --- a/legacy/evas/src/lib/canvas/evas_object_text.c +++ b/legacy/evas/src/lib/canvas/evas_object_text.c @@ -872,8 +872,7 @@ evas_object_text_inset_get(const Evas_Object *obj) MAGIC_CHECK_END(); if (!o->engine_data) return 0; if (!o->items) return 0; - text = o->items->text; - return ENFN->font_inset_get(ENDT, o->engine_data, text); + return ENFN->font_inset_get(ENDT, o->engine_data, &o->items->text_props); } /** diff --git a/legacy/evas/src/lib/canvas/evas_object_textblock.c b/legacy/evas/src/lib/canvas/evas_object_textblock.c index bb6dd4e..1a67832 100644 --- a/legacy/evas/src/lib/canvas/evas_object_textblock.c +++ b/legacy/evas/src/lib/canvas/evas_object_textblock.c @@ -2635,7 +2635,7 @@ _text_item_update_sizes(Ctxt *c, Evas_Object_Textblock_Text_Item *ti) inset = 0; if (fmt->font.font) inset = c->ENFN->font_inset_get(c->ENDT, fmt->font.font, - ti->text); + &ti->parent.text_props); ti->inset = inset; adv = 0; if (fmt->font.font) diff --git a/legacy/evas/src/lib/engines/common/evas_font.h b/legacy/evas/src/lib/engines/common/evas_font.h index bf5a570..3db4366 100644 --- a/legacy/evas/src/lib/engines/common/evas_font.h +++ b/legacy/evas/src/lib/engines/common/evas_font.h @@ -57,7 +57,7 @@ EAPI void evas_common_font_all_clear (void); EAPI int evas_common_font_query_kerning (RGBA_Font_Int* fi, FT_UInt left, FT_UInt right, int* kerning); EAPI void evas_common_font_query_size (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int *w, int *h); -EAPI int evas_common_font_query_inset (RGBA_Font *fn, const Eina_Unicode *text); +EAPI int evas_common_font_query_inset (RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props); EAPI void evas_common_font_query_advance (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int *h_adv, int *v_adv); EAPI int evas_common_font_query_char_coords (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch); EAPI int evas_common_font_query_pen_coords (RGBA_Font *fn, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch); diff --git a/legacy/evas/src/lib/engines/common/evas_font_query.c b/legacy/evas/src/lib/engines/common/evas_font_query.c index df28018..6150163 100644 --- a/legacy/evas/src/lib/engines/common/evas_font_query.c +++ b/legacy/evas/src/lib/engines/common/evas_font_query.c @@ -61,48 +61,10 @@ evas_common_font_query_kerning(RGBA_Font_Int* fi, /* text x inset */ /* FIXME: should use OT info when available. */ EAPI int -evas_common_font_query_inset(RGBA_Font *fn, const Eina_Unicode *text) +evas_common_font_query_inset(RGBA_Font *fn __UNUSED__, const Evas_Text_Props *text_props) { - FT_UInt index; - RGBA_Font_Glyph *fg; - int gl; - RGBA_Font_Int *fi; - - fi = fn->fonts->data; - - if (!*text) return 0; - gl = *text; - if (gl == 0) return 0; -// evas_common_font_size_use(fn); - index = evas_common_font_glyph_search(fn, &fi, gl); - LKL(fi->ft_mutex); - evas_common_font_int_reload(fi); - if (fi->src->current_size != fi->size) - { - FTLOCK(); - FT_Activate_Size(fi->ft.size); - FTUNLOCK(); - fi->src->current_size = fi->size; - } - fg = evas_common_font_int_cache_glyph_get(fi, index); - LKU(fi->ft_mutex); - if (!fg) return 0; -/* - INF("fg->glyph_out->left = %i, " - "fi->src->ft.face->glyph->bitmap_left = %i, " - "fi->src->ft.face->glyph->metrics.horiBearingX = %i, " - "fi->src->ft.face->glyph->metrics.horiBearingY = %i, " - "fi->src->ft.face->glyph->metrics.horiAdvance = %i" - , - (int)fg->glyph_out->left, - (int)fi->src->ft.face->glyph->bitmap_left, - (int)fi->src->ft.face->glyph->metrics.horiBearingX >> 6, - (int)fi->src->ft.face->glyph->metrics.horiBearingY >> 6, - (int)fi->src->ft.face->glyph->metrics.horiAdvance >> 6 - ); - */ - evas_common_font_int_use_trim(); - return fg->glyph_out->left; + if (!text_props->len) return 0; + return text_props->info->glyph[text_props->start].x_bear; } /* size of the string (width and height) in pixels diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h index 26b1b62..88487fd 100644 --- a/legacy/evas/src/lib/include/evas_private.h +++ b/legacy/evas/src/lib/include/evas_private.h @@ -650,7 +650,7 @@ struct _Evas_Func int (*font_max_ascent_get) (void *data, void *font); int (*font_max_descent_get) (void *data, void *font); void (*font_string_size_get) (void *data, void *font, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int *w, int *h); - int (*font_inset_get) (void *data, void *font, const Eina_Unicode *text); + int (*font_inset_get) (void *data, void *font, const Evas_Text_Props *text_props); int (*font_h_advance_get) (void *data, void *font, const Eina_Unicode *text, const Evas_Text_Props *intl_props); int (*font_v_advance_get) (void *data, void *font, const Eina_Unicode *text, const Evas_Text_Props *intl_props); int (*font_char_coords_get) (void *data, void *font, const Eina_Unicode *text, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch); diff --git a/legacy/evas/src/modules/engines/cairo_x11/evas_engine.c b/legacy/evas/src/modules/engines/cairo_x11/evas_engine.c index 33c9ea9..0f9ea14 100644 --- a/legacy/evas/src/modules/engines/cairo_x11/evas_engine.c +++ b/legacy/evas/src/modules/engines/cairo_x11/evas_engine.c @@ -89,7 +89,7 @@ static int eng_font_descent_get(void *data, void *font); static int eng_font_max_ascent_get(void *data, void *font); static int eng_font_max_descent_get(void *data, void *font); static void eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h); -static int eng_font_inset_get(void *data, void *font, char *text); +static int eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props); static int eng_font_h_advance_get(void *data, void *font, char *text); static int eng_font_v_advance_get(void *data, void *font, char *text); static int eng_font_char_coords_get(void *data, void *font, char *text, int pos, int *cx, int *cy, int *cw, int *ch); @@ -1238,7 +1238,7 @@ eng_font_string_size_get(void *data, void *font, char *text, int *w, int *h) } static int -eng_font_inset_get(void *data, void *font, char *text) +eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props) { Render_Engine *re; diff --git a/legacy/evas/src/modules/engines/quartz/evas_engine.c b/legacy/evas/src/modules/engines/quartz/evas_engine.c index a26f2cd..c10d880 100644 --- a/legacy/evas/src/modules/engines/quartz/evas_engine.c +++ b/legacy/evas/src/modules/engines/quartz/evas_engine.c @@ -1050,7 +1050,7 @@ eng_font_string_size_get(void *data, void *font, const char *text, const Evas_Te } static int -eng_font_inset_get(void *data, void *font, const char *text) +eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props) { return 0; } diff --git a/legacy/evas/src/modules/engines/quartz/evas_quartz_private.h b/legacy/evas/src/modules/engines/quartz/evas_quartz_private.h index cd7ef3e..c1a1123 100644 --- a/legacy/evas/src/modules/engines/quartz/evas_quartz_private.h +++ b/legacy/evas/src/modules/engines/quartz/evas_quartz_private.h @@ -76,7 +76,7 @@ static int eng_font_descent_get(void *data, void *font); static int eng_font_max_ascent_get(void *data, void *font); static int eng_font_max_descent_get(void *data, void *font); static void eng_font_string_size_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props, int *w, int *h); -static int eng_font_inset_get(void *data, void *font, const char *text); +static int eng_font_inset_get(void *data, void *font, const Evas_Text_Props *intl_props); static int eng_font_h_advance_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props); static int eng_font_v_advance_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props); static int eng_font_char_coords_get(void *data, void *font, const char *text, const Evas_Text_Props *intl_props, int pos, int *cx, int *cy, int *cw, int *ch); diff --git a/legacy/evas/src/modules/engines/software_16/evas_engine.c b/legacy/evas/src/modules/engines/software_16/evas_engine.c index 16aa6a4..fd657d9 100644 --- a/legacy/evas/src/modules/engines/software_16/evas_engine.c +++ b/legacy/evas/src/modules/engines/software_16/evas_engine.c @@ -511,9 +511,9 @@ eng_font_string_size_get(void *data __UNUSED__, void *font, const Eina_Unicode * } static int -eng_font_inset_get(void *data __UNUSED__, void *font, const Eina_Unicode *text) +eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props) { - return evas_common_font_query_inset(font, text); + return evas_common_font_query_inset(font, text_props); } static int diff --git a/legacy/evas/src/modules/engines/software_8/evas_engine.c b/legacy/evas/src/modules/engines/software_8/evas_engine.c index 1a20036..bc8b933 100644 --- a/legacy/evas/src/modules/engines/software_8/evas_engine.c +++ b/legacy/evas/src/modules/engines/software_8/evas_engine.c @@ -568,9 +568,9 @@ eng_font_string_size_get(void *data __UNUSED__, void *font, const Eina_Unicode * } static int -eng_font_inset_get(void *data __UNUSED__, void *font, const Eina_Unicode *text) +eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props) { - return evas_common_font_query_inset(font, text); + return evas_common_font_query_inset(font, text_props); } static int diff --git a/legacy/evas/src/modules/engines/software_generic/evas_engine.c b/legacy/evas/src/modules/engines/software_generic/evas_engine.c index c96fd5e..be96fe1 100644 --- a/legacy/evas/src/modules/engines/software_generic/evas_engine.c +++ b/legacy/evas/src/modules/engines/software_generic/evas_engine.c @@ -689,9 +689,9 @@ eng_font_string_size_get(void *data __UNUSED__, void *font, const Eina_Unicode * } static int -eng_font_inset_get(void *data __UNUSED__, void *font, const Eina_Unicode *text) +eng_font_inset_get(void *data __UNUSED__, void *font, const Evas_Text_Props *text_props) { - return evas_common_font_query_inset(font, text); + return evas_common_font_query_inset(font, text_props); } static int