From 64c57a2f1bcd9e0b275c478c263c98d24a21caad Mon Sep 17 00:00:00 2001 From: tasn Date: Sun, 30 Jan 2011 10:34:13 +0000 Subject: [PATCH] Evas textblock: Added evas_textblock_cursor_pen_geometry_get. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@56433 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Evas.h | 1 + src/lib/canvas/evas_object_textblock.c | 51 +++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/lib/Evas.h b/src/lib/Evas.h index bad2ede..13731d2 100644 --- a/src/lib/Evas.h +++ b/src/lib/Evas.h @@ -1448,6 +1448,7 @@ typedef void (*Evas_Object_Image_Pixels_Get_Cb) (void *data, Evas_Object *o); EAPI int evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch, Evas_BiDi_Direction *dir, Evas_Textblock_Cursor_Type ctype) EINA_ARG_NONNULL(1); EAPI int evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1); + EAPI int evas_textblock_cursor_pen_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cpen_x, Evas_Coord *cy, Evas_Coord *cadv, Evas_Coord *ch) EINA_ARG_NONNULL(1); EAPI int evas_textblock_cursor_line_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) EINA_ARG_NONNULL(1); EAPI Eina_Bool evas_textblock_cursor_char_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord x, Evas_Coord y) EINA_ARG_NONNULL(1); EAPI int evas_textblock_cursor_line_coord_set(Evas_Textblock_Cursor *cur, Evas_Coord y) EINA_ARG_NONNULL(1); diff --git a/src/lib/canvas/evas_object_textblock.c b/src/lib/canvas/evas_object_textblock.c index 781c194..a1ee0c3 100644 --- a/src/lib/canvas/evas_object_textblock.c +++ b/src/lib/canvas/evas_object_textblock.c @@ -6781,19 +6781,10 @@ evas_textblock_cursor_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord return ret; } - -/** - * Returns the geometry of the char at cur. - * - * @param cur the position of the char. - * @param cx the x of the char. - * @param cy the y of the char. - * @param cw the width of the char. - * @param ch the height of the char. - * @return line number of the char on success, -1 on error. +/** FIXME: doc */ -EAPI int -evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) +static int +_evas_textblock_cursor_char_pen_geometry_common_get(int (*query_func) (void *data, void *font, const Eina_Unicode *text, const Evas_BiDi_Props *intl_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch), const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) { Evas_Object_Textblock *o; Evas_Object_Textblock_Line *ln = NULL; @@ -6846,7 +6837,7 @@ evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C if (pos < 0) pos = 0; if (ti->format->font.font) { - ret = cur->ENFN->font_char_coords_get(cur->ENDT, + ret = query_func(cur->ENDT, ti->format->font.font, ti->text, &ti->parent.bidi_props, pos, @@ -6910,6 +6901,40 @@ evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_C } /** + * Returns the geometry of the char at cur. + * + * @param cur the position of the char. + * @param cx the x of the char. + * @param cy the y of the char. + * @param cw the w of the char. + * @param ch the h of the char. + * @return line number of the char on success, -1 on error. + */ +EAPI int +evas_textblock_cursor_char_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) +{ + return _evas_textblock_cursor_char_pen_geometry_common_get( + cur->ENFN->font_char_coords_get, cur, cx, cy, cw, ch); +} + +/** + * Returns the geometry of the pen at cur. + * + * @param cur the position of the char. + * @param cpen_x the pen_x of the char. + * @param cy the y of the char. + * @param cadv the adv of the char. + * @param ch the h of the char. + * @return line number of the char on success, -1 on error. + */ +EAPI int +evas_textblock_cursor_pen_geometry_get(const Evas_Textblock_Cursor *cur, Evas_Coord *cx, Evas_Coord *cy, Evas_Coord *cw, Evas_Coord *ch) +{ + return _evas_textblock_cursor_char_pen_geometry_common_get( + cur->ENFN->font_pen_coords_get, cur, cx, cy, cw, ch); +} + +/** * Returns the geometry of the line at cur. * * @param cur the position of the line. -- 2.7.4