summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSubodh Kumar <s7158.kumar@samsung.com>2015-05-27 11:14:59 +0100
committerTom Hacohen <tom@stosb.com>2015-05-27 11:18:19 +0100
commit77e3ac7f82bacdf7da2251625e6badd3b5d2123e (patch)
treed19bfe26f928eaa8bee414fb47435ea240de77c9 /src
parent0e2dee5b2efcb192d6ff34d5bcf8f470f4cfe691 (diff)
Evas textblock: Add underline height support
Summary: For showing text error like spell error thick underline is used hence added the underline height support. @feature Test Plan: test case added in evas textblock test. Reviewers: raster, shilpasingh, tasn Subscribers: govi, rajeshps, cedric Differential Revision: https://phab.enlightenment.org/D2531 TAsn comment: I wonder if the format should be renamed to underline_relheight instead of height. If you have any thoughts, please let me know.
Diffstat (limited to 'src')
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c24
-rw-r--r--src/tests/evas/evas_test_textblock.c1
2 files changed, 24 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 6cf26485f9..664df75896 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -444,6 +444,7 @@ struct _Evas_Object_Textblock_Format
444 int linegap; /**< Value to set the line gap in text. */ 444 int linegap; /**< Value to set the line gap in text. */
445 int underline_dash_width; /**< Valule to set the width of the underline dash. */ 445 int underline_dash_width; /**< Valule to set the width of the underline dash. */
446 int underline_dash_gap; /**< Value to set the gap of the underline dash. */ 446 int underline_dash_gap; /**< Value to set the gap of the underline dash. */
447 double underline_height; /**< Value to set the height of the single underline. */
447 double linerelsize; /**< Value to set the size of line of text. */ 448 double linerelsize; /**< Value to set the size of line of text. */
448 double linerelgap; /**< Value for setting line gap. */ 449 double linerelgap; /**< Value for setting line gap. */
449 double linefill; /**< The value must be a percentage. */ 450 double linefill; /**< The value must be a percentage. */
@@ -1130,6 +1131,7 @@ static const char *ellipsisstr = NULL;
1130static const char *passwordstr = NULL; 1131static const char *passwordstr = NULL;
1131static const char *underline_dash_widthstr = NULL; 1132static const char *underline_dash_widthstr = NULL;
1132static const char *underline_dash_gapstr = NULL; 1133static const char *underline_dash_gapstr = NULL;
1134static const char *underline_heightstr = NULL;
1133 1135
1134/** 1136/**
1135 * @page evas_textblock_style_page Evas Textblock Style Options 1137 * @page evas_textblock_style_page Evas Textblock Style Options
@@ -1190,6 +1192,7 @@ _format_command_init(void)
1190 * @li @ref evas_textblock_style_password 1192 * @li @ref evas_textblock_style_password
1191 * @li @ref evas_textblock_style_underline_dash_width 1193 * @li @ref evas_textblock_style_underline_dash_width
1192 * @li @ref evas_textblock_style_underline_dash_gap 1194 * @li @ref evas_textblock_style_underline_dash_gap
1195 * @li @ref evas_textblock_style_underline_height
1193 * 1196 *
1194 * @section evas_textblock_style_contents Contents 1197 * @section evas_textblock_style_contents Contents
1195 */ 1198 */
@@ -1231,6 +1234,7 @@ _format_command_init(void)
1231 passwordstr = eina_stringshare_add("password"); 1234 passwordstr = eina_stringshare_add("password");
1232 underline_dash_widthstr = eina_stringshare_add("underline_dash_width"); 1235 underline_dash_widthstr = eina_stringshare_add("underline_dash_width");
1233 underline_dash_gapstr = eina_stringshare_add("underline_dash_gap"); 1236 underline_dash_gapstr = eina_stringshare_add("underline_dash_gap");
1237 underline_heightstr = eina_stringshare_add("underline_height");
1234 } 1238 }
1235 format_refcount++; 1239 format_refcount++;
1236} 1240}
@@ -1282,6 +1286,7 @@ _format_command_shutdown(void)
1282 eina_stringshare_del(passwordstr); 1286 eina_stringshare_del(passwordstr);
1283 eina_stringshare_del(underline_dash_widthstr); 1287 eina_stringshare_del(underline_dash_widthstr);
1284 eina_stringshare_del(underline_dash_gapstr); 1288 eina_stringshare_del(underline_dash_gapstr);
1289 eina_stringshare_del(underline_heightstr);
1285} 1290}
1286 1291
1287/** 1292/**
@@ -2317,6 +2322,21 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
2317 fmt->underline_dash_gap = atoi(param); 2322 fmt->underline_dash_gap = atoi(param);
2318 if (fmt->underline_dash_gap <= 0) fmt->underline_dash_gap = 1; 2323 if (fmt->underline_dash_gap <= 0) fmt->underline_dash_gap = 1;
2319 } 2324 }
2325 else if (cmd == underline_heightstr)
2326 {
2327 /**
2328 * @page evas_textblock_style_page Evas Textblock Style Options
2329 *
2330 * @subsection evas_textblock_style_underline_height Underline height
2331 *
2332 * Sets the height of the single underline. The value should be a floating number.
2333 * @code
2334 * underline_height=<floatingnumber>
2335 * @endcode
2336 */
2337 fmt->underline_height = atof(param);
2338 if (fmt->underline_height <= 0.0) fmt->underline_height = 1.0;
2339 }
2320} 2340}
2321 2341
2322/** 2342/**
@@ -3000,6 +3020,7 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
3000 fmt->linegap = 0; 3020 fmt->linegap = 0;
3001 fmt->underline_dash_width = 6; 3021 fmt->underline_dash_width = 6;
3002 fmt->underline_dash_gap = 2; 3022 fmt->underline_dash_gap = 2;
3023 fmt->underline_height = 1.0;
3003 fmt->linerelgap = 0.0; 3024 fmt->linerelgap = 0.0;
3004 fmt->password = 1; 3025 fmt->password = 1;
3005 fmt->ellipsis = -1; 3026 fmt->ellipsis = -1;
@@ -11699,7 +11720,8 @@ evas_object_textblock_render(Evas_Object *eo_obj EINA_UNUSED,
11699 DRAW_FORMAT(strikethrough, (ln->h / 2), line_thickness); 11720 DRAW_FORMAT(strikethrough, (ln->h / 2), line_thickness);
11700 11721
11701 /* UNDERLINE */ 11722 /* UNDERLINE */
11702 DRAW_FORMAT(underline, ln->baseline + line_position, line_thickness); 11723 DRAW_FORMAT(underline, ln->baseline + line_position,
11724 line_thickness * itr->format->underline_height);
11703 11725
11704 /* UNDERLINE DASHED */ 11726 /* UNDERLINE DASHED */
11705 DRAW_FORMAT_DASHED(underline_dash, ln->baseline + line_position, 11727 DRAW_FORMAT_DASHED(underline_dash, ln->baseline + line_position,
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 55810e9962..b8dcd45fb8 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -2842,6 +2842,7 @@ START_TEST(evas_textblock_formats)
2842 "<font_size=40>font_size=40</><ps/>" 2842 "<font_size=40>font_size=40</><ps/>"
2843 "<color=#F210B3FF>color=#F210B3FF</><ps/>" 2843 "<color=#F210B3FF>color=#F210B3FF</><ps/>"
2844 "<underline=single underline_color=#A2B3C4>underline=single underline_color=#A2B3C4</><ps/>" 2844 "<underline=single underline_color=#A2B3C4>underline=single underline_color=#A2B3C4</><ps/>"
2845 "<underline=single underline_color=#F2D006 underline_height=5.5>underline=single underline_color=#F2D006 underline_height=5.5</><ps/>"
2845 "<underline=double underline_color=#F00 underline2_color=#00F>underline=double underline_color=#F00 underline2_color=#00F</><ps/>" 2846 "<underline=double underline_color=#F00 underline2_color=#00F>underline=double underline_color=#F00 underline2_color=#00F</><ps/>"
2846 "<underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1>underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1</><ps/>" 2847 "<underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1>underline=dashed underline_dash_color=#0F0 underline_dash_width=2 underline_dash_gap=1</><ps/>"
2847 "<style=outline outline_color=#F0FA>style=outline outline_color=#F0FA</><ps/>" 2848 "<style=outline outline_color=#F0FA>style=outline outline_color=#F0FA</><ps/>"