tasn pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=04b28686afbffce1305d00eec27752889b8cc9b2
commit 04b28686afbffce1305d00eec27752889b8cc9b2 Author: Tom Hacohen <t...@stosb.com> Date: Wed Oct 2 11:41:41 2013 +0100 Evas Textblock: Use font underline properties. This change causes textblock to use the font properties when drawing underline. --- ChangeLog | 5 +++++ NEWS | 1 + src/lib/evas/canvas/evas_object_textblock.c | 22 ++++++++++++++++++---- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1206dcc..6289b14 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-10-02 Tom Hacohen + + * Evas textblock: Use correct font underline properties when drawing + underlines. + 2013-10-01 Vincent Torri * Evas: add JPEG 2000 support. diff --git a/NEWS b/NEWS index b486810..93e9e9a 100644 --- a/NEWS +++ b/NEWS @@ -69,6 +69,7 @@ Additions: - Evas font: Use our own fontconfig configuration so we don't get affected by changes made to the default fontconfig configuration. - Evas font: Make the evas_font_path_* functions apply to fontconfig searches. - Add JPEG 2000 loader. + - Evas textblock: Use correct font underline properties when drawing underlines. * Ecore_X: - Add window profile support. ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index ce34a1c..021f59a 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -3460,6 +3460,8 @@ loop_advance: } c->ln->baseline = c->ascent; + /* FIXME: Actually needs to be adjusted using the actual font value. + * Also, underline_extend is actually not being used. */ if (c->have_underline2) { if (c->descent < 4) c->underline_extend = 4 - c->descent; @@ -11087,6 +11089,11 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, ITEM_WALK_END(); /* normal text and lines */ + /* Get the thickness and position, and save them for non-text items. */ + int line_thickness = + evas_common_font_instance_underline_thickness_get(NULL); + int line_position = + evas_common_font_instance_underline_position_get(NULL); ITEM_WALK() { Evas_Object_Textblock_Text_Item *ti; @@ -11094,23 +11101,30 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED, /* NORMAL TEXT */ if (ti) { + void *fi = _ITEM_TEXT(itr)->text_props.font_instance; COLOR_SET(normal); DRAW_TEXT(0, 0); + line_thickness = + evas_common_font_instance_underline_thickness_get(fi); + line_position = + evas_common_font_instance_underline_position_get(fi); } /* STRIKETHROUGH */ - DRAW_FORMAT(strikethrough, (ln->h / 2), 1); + DRAW_FORMAT(strikethrough, (ln->h / 2), line_thickness); /* UNDERLINE */ - DRAW_FORMAT(underline, ln->baseline + 1, 1); + DRAW_FORMAT(underline, ln->baseline + line_position, line_thickness); /* UNDERLINE DASHED */ - DRAW_FORMAT_DASHED(underline_dash, ln->baseline + 1, 1, + DRAW_FORMAT_DASHED(underline_dash, ln->baseline + line_position, + line_thickness, ti->parent.format->underline_dash_width, ti->parent.format->underline_dash_gap); /* UNDERLINE2 */ - DRAW_FORMAT(underline2, ln->baseline + 3, 1); + DRAW_FORMAT(underline2, ln->baseline + line_position + line_thickness + + line_position, line_thickness); } ITEM_WALK_END(); } --