summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2013-10-02 11:41:41 +0100
committerTom Hacohen <tom@stosb.com>2013-10-02 11:46:25 +0100
commit04b28686afbffce1305d00eec27752889b8cc9b2 (patch)
treed1fc9ae087530a83d33942468aa53fc36f39faa2
parentfca131d6fae726d3710b53c8088053c8eb6a427b (diff)
Evas Textblock: Use font underline properties.
This change causes textblock to use the font properties when drawing underline.
-rw-r--r--ChangeLog5
-rw-r--r--NEWS1
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c22
3 files changed, 24 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 1206dcc659..6289b14ddd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
12013-10-02 Tom Hacohen
2
3 * Evas textblock: Use correct font underline properties when drawing
4 underlines.
5
12013-10-01 Vincent Torri 62013-10-01 Vincent Torri
2 7
3 * Evas: add JPEG 2000 support. 8 * Evas: add JPEG 2000 support.
diff --git a/NEWS b/NEWS
index b486810930..93e9e9a827 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,7 @@ Additions:
69 - Evas font: Use our own fontconfig configuration so we don't get affected by changes made to the default fontconfig configuration. 69 - Evas font: Use our own fontconfig configuration so we don't get affected by changes made to the default fontconfig configuration.
70 - Evas font: Make the evas_font_path_* functions apply to fontconfig searches. 70 - Evas font: Make the evas_font_path_* functions apply to fontconfig searches.
71 - Add JPEG 2000 loader. 71 - Add JPEG 2000 loader.
72 - Evas textblock: Use correct font underline properties when drawing underlines.
72 * Ecore_X: 73 * Ecore_X:
73 - Add window profile support. 74 - Add window profile support.
74 ECORE_X_ATOM_E_WINDOW_PROFILE_SUPPORTED 75 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 ce34a1cdfe..021f59aaee 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:
3460 } 3460 }
3461 3461
3462 c->ln->baseline = c->ascent; 3462 c->ln->baseline = c->ascent;
3463 /* FIXME: Actually needs to be adjusted using the actual font value.
3464 * Also, underline_extend is actually not being used. */
3463 if (c->have_underline2) 3465 if (c->have_underline2)
3464 { 3466 {
3465 if (c->descent < 4) c->underline_extend = 4 - c->descent; 3467 if (c->descent < 4) c->underline_extend = 4 - c->descent;
@@ -11087,6 +11089,11 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
11087 ITEM_WALK_END(); 11089 ITEM_WALK_END();
11088 11090
11089 /* normal text and lines */ 11091 /* normal text and lines */
11092 /* Get the thickness and position, and save them for non-text items. */
11093 int line_thickness =
11094 evas_common_font_instance_underline_thickness_get(NULL);
11095 int line_position =
11096 evas_common_font_instance_underline_position_get(NULL);
11090 ITEM_WALK() 11097 ITEM_WALK()
11091 { 11098 {
11092 Evas_Object_Textblock_Text_Item *ti; 11099 Evas_Object_Textblock_Text_Item *ti;
@@ -11094,23 +11101,30 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
11094 /* NORMAL TEXT */ 11101 /* NORMAL TEXT */
11095 if (ti) 11102 if (ti)
11096 { 11103 {
11104 void *fi = _ITEM_TEXT(itr)->text_props.font_instance;
11097 COLOR_SET(normal); 11105 COLOR_SET(normal);
11098 DRAW_TEXT(0, 0); 11106 DRAW_TEXT(0, 0);
11107 line_thickness =
11108 evas_common_font_instance_underline_thickness_get(fi);
11109 line_position =
11110 evas_common_font_instance_underline_position_get(fi);
11099 } 11111 }
11100 11112
11101 /* STRIKETHROUGH */ 11113 /* STRIKETHROUGH */
11102 DRAW_FORMAT(strikethrough, (ln->h / 2), 1); 11114 DRAW_FORMAT(strikethrough, (ln->h / 2), line_thickness);
11103 11115
11104 /* UNDERLINE */ 11116 /* UNDERLINE */
11105 DRAW_FORMAT(underline, ln->baseline + 1, 1); 11117 DRAW_FORMAT(underline, ln->baseline + line_position, line_thickness);
11106 11118
11107 /* UNDERLINE DASHED */ 11119 /* UNDERLINE DASHED */
11108 DRAW_FORMAT_DASHED(underline_dash, ln->baseline + 1, 1, 11120 DRAW_FORMAT_DASHED(underline_dash, ln->baseline + line_position,
11121 line_thickness,
11109 ti->parent.format->underline_dash_width, 11122 ti->parent.format->underline_dash_width,
11110 ti->parent.format->underline_dash_gap); 11123 ti->parent.format->underline_dash_gap);
11111 11124
11112 /* UNDERLINE2 */ 11125 /* UNDERLINE2 */
11113 DRAW_FORMAT(underline2, ln->baseline + 3, 1); 11126 DRAW_FORMAT(underline2, ln->baseline + line_position + line_thickness +
11127 line_position, line_thickness);
11114 } 11128 }
11115 ITEM_WALK_END(); 11129 ITEM_WALK_END();
11116} 11130}