diff options
author | Tom Hacohen <tom@stosb.com> | 2013-10-02 11:41:41 +0100 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2013-10-02 11:46:25 +0100 |
commit | 04b28686afbffce1305d00eec27752889b8cc9b2 (patch) | |
tree | d1fc9ae087530a83d33942468aa53fc36f39faa2 | |
parent | fca131d6fae726d3710b53c8088053c8eb6a427b (diff) |
Evas Textblock: Use font underline properties.
This change causes textblock to use the font properties when drawing
underline.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/lib/evas/canvas/evas_object_textblock.c | 22 |
3 files changed, 24 insertions, 4 deletions
@@ -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. @@ -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 ce34a1cdf..021f59aae 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(); } |