summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorabdulleh Ghujeh <a.ghujeh@samsung.com>2019-11-28 13:14:15 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2019-11-28 13:14:15 +0900
commitf6caca1d70b750dcb73329fabcd8da01876d7a2f (patch)
tree270e4e6349aade773e7c9b728d97299540aa82b3
parent2ca6c301e4ad75f9a58432db75215d1d29c73bd4 (diff)
Efl Canvas Text : Modify Style Property
Summary: This patch defines the way style property will work at canvas_text object 1- Changing canvas_text style property using Font/Format/Style interfaces or with efl_canvas_text style property are the same. Example: ``` efl_text_font_set(tb, "Arial", 30); //is same as efl_canvas_text_style_set(tb, "font=Arial font_size=30"); //which means calling char * font; int size; int font_size; efl_text_font_get(tb, &font, &size); // calling this after any of the top two functions will return same result ``` 2- style_get_property Will return string that contains full details about all the current applied style at canvas_text level. 3- style_set_property Will only override passed styles and leave everything else as it is ``` efl_canvas_text_style_set(tb, "font=Arial"); // overrider font name to Arial and leave everthing else efl_canvas_text_style_set(tb, "font_size=30"); // overrider font size to 30 and leave everthing else (font name will stay arial) ``` Reviewers: ali.alzyod, woohyun, tasn, segfaultxavi, bu5hm4n, zmike Reviewed By: woohyun Subscribers: zmike, bu5hm4n, segfaultxavi, a.srour, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10607
-rw-r--r--src/bin/elementary/test_photocam.c3
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo29
-rw-r--r--src/lib/evas/canvas/evas_font_dir.c42
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c574
-rw-r--r--src/lib/evas/common/evas_font.h3
-rw-r--r--src/tests/evas/evas_test_textblock.c59
6 files changed, 647 insertions, 63 deletions
diff --git a/src/bin/elementary/test_photocam.c b/src/bin/elementary/test_photocam.c
index eb068e6..78aa528 100644
--- a/src/bin/elementary/test_photocam.c
+++ b/src/bin/elementary/test_photocam.c
@@ -817,7 +817,8 @@ test_image_zoomable_animated(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
817 efl_text_set(efl_added, "Clicking the image will play/pause animation."), 817 efl_text_set(efl_added, "Clicking the image will play/pause animation."),
818 efl_text_interactive_editable_set(efl_added, EINA_FALSE), 818 efl_text_interactive_editable_set(efl_added, EINA_FALSE),
819 efl_gfx_hint_weight_set(efl_added, 1, 0), 819 efl_gfx_hint_weight_set(efl_added, 1, 0),
820 efl_canvas_text_style_set(efl_added, NULL, "DEFAULT='align=center font=Sans font_size=10 color=#fff wrap=word'"), 820 efl_text_font_set(efl_added, "Sans", 10),
821 efl_text_normal_color_set(efl_added, 255, 255, 255, 255),
821 efl_pack(bx, efl_added) 822 efl_pack(bx, efl_added)
822 ); 823 );
823 824
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index 10c43c7..f5e6af1 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -75,26 +75,19 @@ class @beta Efl.Canvas.Text extends Efl.Canvas.Object implements Efl.Text,
75 mode: bool; [[$true for legacy mode, $false otherwise]] 75 mode: bool; [[$true for legacy mode, $false otherwise]]
76 } 76 }
77 } 77 }
78 @property style { 78 style_apply {
79 [[The text style of the object. 79 [[apply the style for this object, sent style member will override old ones, other styles will not be affected.
80 80 similar to setting style using functions (for example font_slant_set, wrap_set).]]
81 $key is how you reference the style (for deletion or fetching). $NULL 81 params {
82 as key indicates the style has the highest priority (default style). 82 @in style: string; [[A whitespace-separated list of $[property=value] pairs, for example, $[font=sans size=30].]]
83 The style priority is the order of creation, styles created first
84 are applied first with the exception of $NULL which is implicitly
85 first.
86
87 Set $style to $NULL to delete it.
88 ]]
89 set {
90 }
91 get {
92 }
93 keys {
94 key: string; [[The name to the style. $NULL is the default style]]
95 } 83 }
84 }
85 @property all_styles {
86 [[Get all styles belong to this object as string (default styles plus styles
87 from style_apply or style functions (for example font_slant_set, wrap_set).]]
88 get {}
96 values { 89 values {
97 style: string; [[The style]] 90 style: string; [[All styles, should not be freed.]]
98 } 91 }
99 } 92 }
100 @property size_formatted { 93 @property size_formatted {
diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c
index b1bbb6b..5b945dc 100644
--- a/src/lib/evas/canvas/evas_font_dir.c
+++ b/src/lib/evas/canvas/evas_font_dir.c
@@ -429,12 +429,50 @@ static Style_Map _style_spacing_map[] =
429}; 429};
430 430
431#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x))) 431#define _STYLE_MAP_LEN(x) (sizeof(x) / sizeof(*(x)))
432
433/**
434 * @internal
435 * Find the string from the map at a style
436 * @return the string at a style type
437 */
438static const char*
439_evas_font_style_find_str_internal(int type, Style_Map _map[], size_t map_len)
440{
441 size_t i;
442 for ( i = 0; i < map_len; i++ )
443 {
444 if (_map[i].type == type)
445 return _map[i].name;
446 }
447 return NULL;
448}
449
450const char*
451evas_font_style_find_str(int type, Evas_Font_Style style)
452{
453#define _RET_STYLE(x) \
454 return _evas_font_style_find_str_internal(type, \
455 _style_##x##_map, _STYLE_MAP_LEN(_style_##x##_map));
456 switch (style)
457 {
458 case EVAS_FONT_STYLE_SLANT:
459 _RET_STYLE(slant);
460 case EVAS_FONT_STYLE_WEIGHT:
461 _RET_STYLE(weight);
462 case EVAS_FONT_STYLE_WIDTH:
463 _RET_STYLE(width);
464 default:
465 return NULL;
466 }
467#undef _RET_STYLE
468}
469
432/** 470/**
433 * @internal 471 * @internal
434 * Find a certain attribute from the map in the style. 472 * Find a certain attribute from the map in the style.
435 * @return the index of the found one. 473 * @return the index of the found one.
436 */ 474 */
437static int 475static unsigned int
438_evas_font_style_find_internal(const char *style, const char *style_end, 476_evas_font_style_find_internal(const char *style, const char *style_end,
439 Style_Map _map[], size_t map_len) 477 Style_Map _map[], size_t map_len)
440{ 478{
@@ -462,7 +500,7 @@ _evas_font_style_find_internal(const char *style, const char *style_end,
462 return 0; 500 return 0;
463} 501}
464 502
465int 503unsigned int
466evas_font_style_find(const char *start, const char *end, 504evas_font_style_find(const char *start, const char *end,
467 Evas_Font_Style style) 505 Evas_Font_Style style)
468{ 506{
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 98cfc9f..68115a6 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -476,6 +476,7 @@ struct _Evas_Object_Textblock
476 Efl_Text_Format_Wrap wrap; 476 Efl_Text_Format_Wrap wrap;
477 Efl_Text_Font_Bitmap_Scalable bitmap_scalable; 477 Efl_Text_Font_Bitmap_Scalable bitmap_scalable;
478 } info; 478 } info;
479 char * default_style_str;
479 } default_format; 480 } default_format;
480 double valign; 481 double valign;
481 Eina_Stringshare *markup_text; 482 Eina_Stringshare *markup_text;
@@ -551,6 +552,7 @@ static int evas_object_textblock_was_opaque(Evas_Object *eo_obj,
551static void evas_object_textblock_coords_recalc(Evas_Object *eo_obj, 552static void evas_object_textblock_coords_recalc(Evas_Object *eo_obj,
552 Evas_Object_Protected_Data *obj, 553 Evas_Object_Protected_Data *obj,
553 void *type_private_data); 554 void *type_private_data);
555static void _canvas_text_format_changed(Eo *eo_obj, Efl_Canvas_Text_Data *o);
554 556
555static const Evas_Object_Func object_func = 557static const Evas_Object_Func object_func =
556{ 558{
@@ -2702,6 +2704,230 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch
2702 } 2704 }
2703} 2705}
2704 2706
2707//FIXME Create common function for both _default _format_command & _format_command
2708/**
2709 * @internal
2710 * Parses the cmd and parameter and adds the parsed format to fmt and fmt info.
2711 *
2712 * @param obj the evas object - should not be NULL.
2713 * @param fmt The format to populate - should not be NULL.
2714 * @param[in] cmd the command to process, should be stringshared.
2715 * @param[in] param the parameter of the command. may modify the string.
2716 */
2717static Eina_Bool
2718_default_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *cmd, char *param)
2719{
2720 EINA_SAFETY_ON_NULL_RETURN_VAL(param, EINA_FALSE);
2721
2722 Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
2723 int len = _format_clean_param(param);
2724 Eina_Bool changed = EINA_FALSE;
2725 const char * font_prefix = "font_";
2726
2727 ASYNC_BLOCK;
2728
2729 if (cmd == fontstr)
2730 {
2731 char *end = strchr(param, ':');
2732
2733 if (!end)
2734 changed = eina_stringshare_replace(&(_FMT_INFO(font)), param);
2735 else
2736 changed = eina_stringshare_replace_length(&(_FMT_INFO(font)), param, end - param);
2737
2738 while (end)
2739 {
2740 const char *tend;
2741 param = end;
2742 end = strchr(end + 1, ':');
2743 if (!end)
2744 tend = param + strlen(param);
2745 else
2746 tend = end;
2747
2748 char *equal = strchr(param, '=');
2749 if (equal)
2750 {
2751 char font_param[strlen(font_prefix) + (equal - param)];
2752 font_param[0] = '\0';
2753 strcat(font_param, font_prefix);
2754 strncat(font_param, &param[1], equal - param -1);
2755 const char *key = eina_stringshare_add(font_param);
2756
2757 char val[tend - equal];
2758 val[0] = '\0';
2759 strncat(val, &equal[1], tend - equal -1);
2760
2761 _default_format_command(eo_obj, fmt, key, val);
2762 eina_stringshare_del(key);
2763 }
2764 }
2765 }
2766 else if (cmd == font_fallbacksstr)
2767 {
2768 changed = eina_stringshare_replace(&(_FMT_INFO(font_fallbacks)), param);
2769 }
2770 else if (cmd == font_sizestr)
2771 {
2772 int size;
2773
2774 size = atoi(param);
2775 if (size > 0 && _FMT_INFO(size) != size)
2776 {
2777 _FMT_INFO(size) = size;
2778 changed = EINA_TRUE;
2779 }
2780 }
2781 else if (cmd == font_sourcestr)
2782 {
2783 Eina_Stringshare *font_source = _FMT_INFO(font_source);
2784 if ((!font_source) ||
2785 ((font_source) && (strcmp(font_source, param))))
2786 {
2787 changed = eina_stringshare_replace(&(_FMT_INFO(font_source)), param);
2788 }
2789 }
2790 else if (cmd == font_weightstr)
2791 {
2792 unsigned int weight = evas_font_style_find(param,
2793 param + len,
2794 EVAS_FONT_STYLE_WEIGHT);
2795
2796 if (_FMT_INFO(font_weight) != weight)
2797 {
2798 _FMT_INFO(font_weight) = weight;
2799 changed = EINA_TRUE;
2800 }
2801 }
2802 else if (cmd == font_stylestr)
2803 {
2804 unsigned int slant = evas_font_style_find(param,
2805 param + len,
2806 EVAS_FONT_STYLE_SLANT);
2807
2808 if (_FMT_INFO(font_slant) != slant)
2809 {
2810 _FMT_INFO(font_slant) = slant;
2811 changed = EINA_TRUE;
2812 }
2813 }
2814 else if (cmd == font_widthstr)
2815 {
2816 unsigned int width = evas_font_style_find(param,
2817 param + len,
2818 EVAS_FONT_STYLE_WIDTH);
2819
2820 if (_FMT_INFO(font_width) != width)
2821 {
2822 _FMT_INFO(font_width) = width;
2823 changed = EINA_TRUE;
2824 }
2825 }
2826 else if (cmd == langstr)
2827 {
2828 changed = eina_stringshare_replace(&(_FMT_INFO(font_lang)),
2829 evas_font_lang_normalize(param));
2830 }
2831 else if (cmd == gfx_filterstr)
2832 {
2833 if (!fmt->gfx_filter)
2834 fmt->gfx_filter = calloc(1, sizeof(Efl_Canvas_Text_Filter));
2835 eina_stringshare_replace(&fmt->gfx_filter->name, param);
2836 eina_stringshare_replace(&(_FMT_INFO(gfx_filter_name)), param);
2837 }
2838 else if (cmd == wrapstr)
2839 {
2840 Efl_Text_Format_Wrap wrap = _FMT_INFO(wrap);
2841
2842 if (!strcmp("word", param))
2843 wrap = EFL_TEXT_FORMAT_WRAP_WORD;
2844 else if (!strcmp("char", param))
2845 wrap = EFL_TEXT_FORMAT_WRAP_CHAR;
2846 else if (!strcmp("mixed", param))
2847 wrap = EFL_TEXT_FORMAT_WRAP_MIXED;
2848 else if (!strcmp("hyphenation", param))
2849 wrap = EFL_TEXT_FORMAT_WRAP_HYPHENATION;
2850
2851 if (_FMT_INFO(wrap) != wrap)
2852 {
2853 _FMT_INFO(wrap) = wrap;
2854 _FMT(wrap_word) = (wrap == EFL_TEXT_FORMAT_WRAP_WORD);
2855 _FMT(wrap_char) = (wrap == EFL_TEXT_FORMAT_WRAP_CHAR);
2856 _FMT(wrap_mixed) = (wrap == EFL_TEXT_FORMAT_WRAP_MIXED);
2857 _FMT(wrap_hyphenation) = (wrap == EFL_TEXT_FORMAT_WRAP_HYPHENATION);
2858 changed = EINA_TRUE;
2859 }
2860 }
2861 else if (cmd == stylestr)
2862 {
2863 const char *p;
2864 char *p1, *p2, *pp;
2865
2866 p2 = alloca(len + 1);
2867 *p2 = 0;
2868 /* no comma */
2869 if (!strstr(param, ",")) p1 = (char*) param;
2870 else
2871 {
2872 p1 = alloca(len + 1);
2873 *p1 = 0;
2874
2875 /* split string "str1,str2" into p1 and p2 (if we have more than
2876 * 1 str2 eg "str1,str2,str3,str4" then we don't care. p2 just
2877 * ends up being the last one as right now it's only valid to have
2878 * 1 comma and 2 strings */
2879 pp = p1;
2880 for (p = param; *p; p++)
2881 {
2882 if (*p == ',')
2883 {
2884 *pp = 0;
2885 pp = p2;
2886 continue;
2887 }
2888 *pp = *p;
2889 pp++;
2890 }
2891 *pp = 0;
2892 }
2893
2894 if (!strcmp(p1, "off")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
2895 else if (!strcmp(p1, "none")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
2896 else if (!strcmp(p1, "plain")) {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
2897 else if (!strcmp(p1, "shadow")) {fmt->style = EVAS_TEXT_STYLE_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW;}
2898 else if (!strcmp(p1, "outline")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE;}
2899 else if (!strcmp(p1, "soft_outline")) {fmt->style = EVAS_TEXT_STYLE_SOFT_OUTLINE; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE;}
2900 else if (!strcmp(p1, "outline_shadow")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW;}
2901 else if (!strcmp(p1, "outline_soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW;}
2902 else if (!strcmp(p1, "glow")) {fmt->style = EVAS_TEXT_STYLE_GLOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_GLOW;}
2903 else if (!strcmp(p1, "far_shadow")) {fmt->style = EVAS_TEXT_STYLE_FAR_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW;}
2904 else if (!strcmp(p1, "soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW;}
2905 else if (!strcmp(p1, "far_soft_shadow")) {fmt->style = EVAS_TEXT_STYLE_FAR_SOFT_SHADOW; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW;}
2906 else {fmt->style = EVAS_TEXT_STYLE_PLAIN; _FMT_INFO(effect) = EFL_TEXT_STYLE_EFFECT_TYPE_NONE;}
2907 if (*p2)
2908 {
2909 if (!strcmp(p2, "bottom_right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;}
2910 else if (!strcmp(p2, "bottom")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM;}
2911 else if (!strcmp(p2, "bottom_left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT;}
2912 else if (!strcmp(p2, "left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT;}
2913 else if (!strcmp(p2, "top_left")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT;}
2914 else if (!strcmp(p2, "top")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP;}
2915 else if (!strcmp(p2, "top_right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT;}
2916 else if (!strcmp(p2, "right")) {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT;}
2917 else {EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(fmt->style, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT); _FMT_INFO(shadow_direction) = EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT;}
2918 }
2919 }
2920 else
2921 {
2922 /* Update reset of formats like color, ...etc*/
2923 _format_command(eo_obj, fmt, cmd, param);
2924 /*FIXME update only when change happened*/
2925 changed = EINA_TRUE;
2926 }
2927
2928 return changed;
2929}
2930
2705/* 2931/*
2706 * @internal 2932 * @internal
2707 * just to create a constant without using marco 2933 * just to create a constant without using marco
@@ -2924,12 +3150,16 @@ _format_parse(const char **s)
2924 * @param obj The evas object - Not NULL. 3150 * @param obj The evas object - Not NULL.
2925 * @param[out] fmt The format to populate - Not NULL. 3151 * @param[out] fmt The format to populate - Not NULL.
2926 * @param[in] str the string to parse.- Not NULL. 3152 * @param[in] str the string to parse.- Not NULL.
3153 * @param[in] is_default_format if this is default format true else false.
2927 */ 3154 */
2928static void 3155static void
2929_format_fill(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *str) 3156_format_fill(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *str, Eina_Bool is_default_format)
2930{ 3157{
2931 const char *s; 3158 const char *s;
2932 const char *item; 3159 const char *item;
3160 Eina_Bool changed = EINA_FALSE;
3161
3162 if (!str) return;
2933 3163
2934 s = str; 3164 s = str;
2935 3165
@@ -2945,7 +3175,16 @@ _format_fill(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char
2945 char *val = NULL; 3175 char *val = NULL;
2946 if (_format_param_parse(item, &key, &val, &allocator)) 3176 if (_format_param_parse(item, &key, &val, &allocator))
2947 { 3177 {
2948 if ((key) && (val)) _format_command(eo_obj, fmt, key, val); 3178 if ((key) && (val))
3179 {
3180 if (is_default_format == EINA_TRUE)
3181 {
3182 if (_default_format_command(eo_obj, fmt, key, val))
3183 changed = EINA_TRUE;
3184 }
3185 else
3186 _format_command(eo_obj, fmt, key, val);
3187 }
2949 eina_stringshare_del(key); 3188 eina_stringshare_del(key);
2950 } 3189 }
2951 else 3190 else
@@ -2954,9 +3193,292 @@ _format_fill(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char
2954 } 3193 }
2955 } 3194 }
2956 3195
3196 if (is_default_format == EINA_TRUE && changed)
3197 {
3198 Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
3199 _canvas_text_format_changed(eo_obj, o);
3200 }
3201
2957 _allocator_reset(&allocator); 3202 _allocator_reset(&allocator);
2958} 3203}
2959 3204
3205#define PRINTF_APPEND_STR(name, val) eina_strbuf_append_printf(format_buffer, "%s=%s ", name, val)
3206#define PRINTF_APPEND_INT(name, val) eina_strbuf_append_printf(format_buffer, "%s=%i ", name, val)
3207#define PRINTF_APPEND_COLOR(name, r, g, b, a) eina_strbuf_append_printf(format_buffer, "%s=rgba(%i,%i,%i,%i) ", name, r, g, b, a)
3208#define PRINTF_APPEND_FLOAT(name, val) eina_strbuf_append_printf(format_buffer, "%s=%f ", name, val)
3209#define PRINTF_APPEND_PERCENT_FLOAT(name, val) eina_strbuf_append_printf(format_buffer, "%s=%f%% ", name, val)
3210
3211/**
3212 * @internal
3213 * get all formats in one string
3214 *
3215 * @param obj The evas object - Not NULL.
3216 * @param[out] fmt The format to convert to string - Not NULL.
3217 * @return the format as string, must be freed by the user.
3218 */
3219static char *
3220_format_string_get(const Eo *eo_obj, Evas_Object_Textblock_Format *fmt)
3221{
3222 Efl_Canvas_Text_Data *o = efl_data_scope_get(eo_obj, MY_CLASS);
3223 Eina_Strbuf *format_buffer = eina_strbuf_new();
3224
3225 //format info
3226
3227 if (_FMT_INFO(font))
3228 PRINTF_APPEND_STR(fontstr, _FMT_INFO(font));
3229
3230 if (_FMT_INFO(font_fallbacks))
3231 PRINTF_APPEND_STR(font_fallbacksstr, _FMT_INFO(font_fallbacks));
3232
3233 PRINTF_APPEND_INT(font_sizestr, _FMT_INFO(size));
3234
3235 if (_FMT_INFO(font_source))
3236 PRINTF_APPEND_STR(font_sourcestr, _FMT_INFO(font_source));
3237
3238 const char *weight_value_str = evas_font_style_find_str(_FMT_INFO(font_weight), EVAS_FONT_STYLE_WEIGHT);
3239 if (!weight_value_str)
3240 weight_value_str = "normal";
3241
3242 PRINTF_APPEND_STR(font_weightstr, weight_value_str);
3243
3244 const char *slant_value_str = evas_font_style_find_str(_FMT_INFO(font_slant), EVAS_FONT_STYLE_SLANT);
3245 if (!slant_value_str)
3246 slant_value_str = "normal";
3247
3248 PRINTF_APPEND_STR(font_stylestr, slant_value_str);
3249
3250 const char *width_value_str = evas_font_style_find_str(_FMT_INFO(font_width), EVAS_FONT_STYLE_WIDTH);
3251 if (!width_value_str)
3252 width_value_str = "normal";
3253
3254 PRINTF_APPEND_STR(font_widthstr, width_value_str);
3255
3256 if (_FMT_INFO(font_lang))
3257 PRINTF_APPEND_STR(langstr, _FMT_INFO(font_lang));
3258
3259 if (_FMT_INFO(gfx_filter_name))
3260 PRINTF_APPEND_STR(gfx_filterstr, _FMT_INFO(gfx_filter_name));
3261
3262 char *wrap_value_str;
3263 Efl_Text_Format_Wrap wrap = _FMT_INFO(wrap);
3264
3265 switch (wrap)
3266 {
3267 case EFL_TEXT_FORMAT_WRAP_CHAR:
3268 wrap_value_str = "char";
3269 break;
3270 case EFL_TEXT_FORMAT_WRAP_MIXED:
3271 wrap_value_str = "mixed";
3272 break;
3273 case EFL_TEXT_FORMAT_WRAP_HYPHENATION:
3274 wrap_value_str = "hyphenation";
3275 break;
3276 default:
3277 wrap_value_str = "word";
3278 break;
3279 }
3280
3281 PRINTF_APPEND_STR(wrapstr, wrap_value_str);
3282
3283 //format
3284 PRINTF_APPEND_COLOR(colorstr, fmt->color.normal.r, fmt->color.normal.g,
3285 fmt->color.normal.b, fmt->color.normal.a);
3286
3287 PRINTF_APPEND_COLOR(underline_colorstr, fmt->color.underline.r, fmt->color.underline.g,
3288 fmt->color.underline.b, fmt->color.underline.a);
3289
3290 PRINTF_APPEND_COLOR(underline2_colorstr, fmt->color.underline2.r, fmt->color.underline2.g,
3291 fmt->color.underline2.b, fmt->color.underline2.a);
3292
3293 PRINTF_APPEND_COLOR(underline_dash_colorstr, fmt->color.underline_dash.r, fmt->color.underline_dash.g,
3294 fmt->color.underline_dash.b, fmt->color.underline_dash.a);
3295
3296 PRINTF_APPEND_COLOR(outline_colorstr, fmt->color.outline.r, fmt->color.outline.g,
3297 fmt->color.outline.b, fmt->color.outline.a);
3298
3299 PRINTF_APPEND_COLOR(shadow_colorstr, fmt->color.shadow.r, fmt->color.shadow.g,
3300 fmt->color.shadow.b, fmt->color.shadow.a);
3301
3302 PRINTF_APPEND_COLOR(glow_colorstr, fmt->color.glow.r, fmt->color.glow.g,
3303 fmt->color.glow.b, fmt->color.glow.a);
3304
3305 PRINTF_APPEND_COLOR(glow2_colorstr, fmt->color.glow2.r, fmt->color.glow2.g,
3306 fmt->color.glow2.b, fmt->color.glow2.a);
3307
3308 PRINTF_APPEND_COLOR(backing_colorstr, fmt->color.backing.r, fmt->color.backing.g,
3309 fmt->color.backing.b, fmt->color.backing.a);
3310
3311 PRINTF_APPEND_COLOR(strikethrough_colorstr, fmt->color.strikethrough.r, fmt->color.strikethrough.g,
3312 fmt->color.strikethrough.b, fmt->color.strikethrough.a);
3313
3314 char *halign_value_str = NULL;
3315 Evas_Textblock_Align_Auto halign = fmt->halign_auto;
3316
3317 switch (halign)
3318 {
3319 case EVAS_TEXTBLOCK_ALIGN_AUTO_NORMAL:
3320 halign_value_str = "auto";
3321 break;
3322 case EVAS_TEXTBLOCK_ALIGN_AUTO_END:
3323 halign_value_str = "end";
3324 break;
3325 case EVAS_TEXTBLOCK_ALIGN_AUTO_LOCALE:
3326 halign_value_str = "locale";
3327 break;
3328 case EVAS_TEXTBLOCK_ALIGN_AUTO_NONE:
3329 if (fmt->halign == 0.5)
3330 halign_value_str = "center";
3331 else if (fmt->halign == 0.0)
3332 halign_value_str = "left";
3333 else if (fmt->halign == 1.0)
3334 halign_value_str = "right";
3335
3336 break;
3337 }
3338
3339 if (halign_value_str != NULL)
3340 PRINTF_APPEND_STR(alignstr, halign_value_str);
3341 else
3342 PRINTF_APPEND_FLOAT(alignstr, fmt->halign);
3343
3344
3345 char *valign_value_str = NULL;
3346
3347 if (fmt->valign == 0.5)
3348 valign_value_str = "center";
3349 else if (fmt->valign == 0.0)
3350 valign_value_str = "top";
3351 else if (fmt->valign == 1.0)
3352 valign_value_str = "bottom";
3353 else if (fmt->valign == -1.0)
3354 valign_value_str = "baseline";
3355
3356 if (valign_value_str != NULL)
3357 PRINTF_APPEND_STR(valignstr, valign_value_str);
3358 else
3359 PRINTF_APPEND_FLOAT(valignstr, fmt->valign);
3360
3361 PRINTF_APPEND_FLOAT(text_valignstr, o->valign);
3362 PRINTF_APPEND_INT(left_marginstr, fmt->margin.l);
3363 PRINTF_APPEND_INT(right_marginstr, fmt->margin.r);
3364
3365
3366 char *underline_value_str = "off";
3367
3368 if (fmt->underline == EINA_TRUE && fmt->underline2 == EINA_TRUE)
3369 underline_value_str = "double";
3370 else if (fmt->underline == EINA_TRUE)
3371 underline_value_str = "single";
3372 else if (fmt->underline_dash == EINA_TRUE)
3373 underline_value_str = "dashed";
3374
3375 PRINTF_APPEND_STR(underlinestr, underline_value_str);
3376 PRINTF_APPEND_STR(strikethroughstr, (fmt->strikethrough == 0 ? "off" : "on"));
3377 PRINTF_APPEND_STR(backingstr, (fmt->backing == 0 ? "off" : "on"));
3378
3379 char *style_value_str_1 = "off";
3380 char *style_value_str_2 = NULL;
3381 Efl_Text_Style_Effect_Type style1 = _FMT_INFO(effect);
3382 Efl_Text_Style_Effect_Type style2 = _FMT_INFO(shadow_direction);
3383
3384 switch (style1)
3385 {
3386 case EFL_TEXT_STYLE_EFFECT_TYPE_NONE:
3387 style_value_str_1 = "plain";
3388 break;
3389 case EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW:
3390 style_value_str_1 = "shadow";
3391 break;
3392 case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE:
3393 style_value_str_1 = "outline";
3394 break;
3395 case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE:
3396 style_value_str_1 = "soft_outline";
3397 break;
3398 case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW:
3399 style_value_str_1 = "outline_shadow";
3400 break;
3401 case EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW:
3402 style_value_str_1 = "outline_soft_shadow";
3403 break;
3404 case EFL_TEXT_STYLE_EFFECT_TYPE_GLOW:
3405 style_value_str_1 = "glow";
3406 break;
3407 case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW:
3408 style_value_str_1 = "far_shadow";
3409 break;
3410 case EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW:
3411 style_value_str_1 = "soft_shadow";
3412 break;
3413 case EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW:
3414 style_value_str_1 = "far_soft_shadow";
3415 break;
3416 default:
3417 style_value_str_1 = "off";
3418 break;
3419 }
3420
3421 switch (style2)
3422 {
3423 case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT:
3424 style_value_str_2 = "bottom_right";
3425 break;
3426 case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM:
3427 style_value_str_2 = "bottom";
3428 break;
3429 case EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT:
3430 style_value_str_2 = "bottom_left";
3431 break;
3432 case EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT:
3433 style_value_str_2 = "left";
3434 break;
3435 case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT:
3436 style_value_str_2 = "top_left";
3437 break;
3438 case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP:
3439 style_value_str_2 = "top";
3440 break;
3441 case EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT:
3442 style_value_str_2 = "top_right";
3443 break;
3444 case EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT:
3445 style_value_str_2 = "right";
3446 break;
3447 default:
3448 style_value_str_2 = NULL;
3449 break;
3450 }
3451
3452 if (style_value_str_2 != NULL)
3453 eina_strbuf_append_printf(format_buffer, "%s=%s,%s ", stylestr, style_value_str_1, style_value_str_2);
3454 else
3455 PRINTF_APPEND_STR(stylestr, style_value_str_1);
3456
3457 PRINTF_APPEND_INT(tabstopsstr, fmt->tabstops);
3458 PRINTF_APPEND_INT(linesizestr, fmt->linesize);
3459 PRINTF_APPEND_PERCENT_FLOAT(linerelsizestr, (fmt->linerelsize*100));
3460 PRINTF_APPEND_INT(linegapstr, fmt->linegap);
3461 PRINTF_APPEND_PERCENT_FLOAT(linerelgapstr, (fmt->linerelgap*100));
3462 PRINTF_APPEND_PERCENT_FLOAT(linefillstr, (fmt->linefill*100));
3463 PRINTF_APPEND_FLOAT(ellipsisstr, fmt->ellipsis);
3464 PRINTF_APPEND_STR(passwordstr, (fmt->password == 0 ? "off" : "on"));
3465
3466 if (o->repch)
3467 PRINTF_APPEND_STR(replacement_charstr, o->repch);
3468
3469 PRINTF_APPEND_INT(underline_dash_widthstr, fmt->underline_dash_width);
3470 PRINTF_APPEND_INT(underline_dash_gapstr, fmt->underline_dash_gap);
3471 PRINTF_APPEND_FLOAT(underline_heightstr, fmt->underline_height);
3472
3473 const char *temp = eina_strbuf_string_get(format_buffer);
3474 size_t len = strlen(temp);
3475 char *format_str = malloc(len+1);
3476 strcpy(format_str, temp);
3477 eina_strbuf_free(format_buffer);
3478
3479 return format_str;
3480}
3481
2960/** 3482/**
2961 * @internal 3483 * @internal
2962 * Duplicate a format and return the duplicate. 3484 * Duplicate a format and return the duplicate.
@@ -6839,7 +7361,7 @@ _layout_setup(Ctxt *c, const Eo *eo_obj, Evas_Coord w, Evas_Coord h)
6839 } 7361 }
6840 if ((c->o->style) && (c->o->style->default_tag)) 7362 if ((c->o->style) && (c->o->style->default_tag))
6841 { 7363 {
6842 _format_fill(c->obj, c->fmt, c->o->style->default_tag); 7364 _format_fill(c->obj, c->fmt, c->o->style->default_tag, EINA_FALSE);
6843 finalize = EINA_TRUE; 7365 finalize = EINA_TRUE;
6844 } 7366 }
6845 7367
@@ -6847,7 +7369,7 @@ _layout_setup(Ctxt *c, const Eo *eo_obj, Evas_Coord w, Evas_Coord h)
6847 { 7369 {
6848 if ((use->st) && (use->st->default_tag)) 7370 if ((use->st) && (use->st->default_tag))
6849 { 7371 {
6850 _format_fill(c->obj, c->fmt, use->st->default_tag); 7372 _format_fill(c->obj, c->fmt, use->st->default_tag, EINA_FALSE);
6851 finalize = EINA_TRUE; 7373 finalize = EINA_TRUE;
6852 } 7374 }
6853 } 7375 }
@@ -7452,41 +7974,12 @@ _style_by_key_find(Efl_Canvas_Text_Data *o, const char *key)
7452 return NULL; 7974 return NULL;
7453} 7975}
7454 7976
7455static Evas_Textblock_Style *
7456_style_fetch(const char *style)
7457{
7458 Evas_Textblock_Style *ts = NULL;
7459 Eina_List *i;
7460
7461 if (!style) return NULL;
7462
7463 EINA_LIST_FOREACH(_style_cache, i, ts)
7464 {
7465 if (ts->style_text == style) break;
7466 }
7467
7468 if (!ts)
7469 {
7470 ts = evas_textblock_style_new();
7471 ts->legacy = EINA_FALSE;
7472 evas_textblock_style_set(ts, style);
7473 _style_cache = eina_list_append(_style_cache, ts);
7474 }
7475 return ts;
7476}
7477
7478EOLIAN static void 7977EOLIAN static void
7479_efl_canvas_text_style_set(Eo *eo_obj, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *key, const char *style) 7978_efl_canvas_text_style_apply(Eo *eo_obj, Efl_Canvas_Text_Data *o, const char *style)
7480{ 7979{
7481 // FIXME: Make key value behaviour.
7482 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); 7980 Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
7483 evas_object_async_block(obj); 7981 evas_object_async_block(obj);
7484 7982 _format_fill(eo_obj, &(o->default_format.format), style, EINA_TRUE);
7485 Evas_Textblock_Style *ts;
7486
7487 ts = _style_fetch(style);
7488
7489 _textblock_style_generic_set(eo_obj, ts, key);
7490} 7983}
7491 7984
7492EAPI Evas_Textblock_Style * 7985EAPI Evas_Textblock_Style *
@@ -7500,11 +7993,13 @@ evas_object_textblock_style_get(const Eo *eo_obj)
7500} 7993}
7501 7994
7502EOLIAN static const char * 7995EOLIAN static const char *
7503_efl_canvas_text_style_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o, const char *key) 7996_efl_canvas_text_all_styles_get(const Eo *eo_obj EINA_UNUSED, Efl_Canvas_Text_Data *o)
7504{ 7997{
7505 Evas_Textblock_Style *ts = _style_by_key_find(o, key); 7998 if (o->default_format.default_style_str)
7999 free(o->default_format.default_style_str);
7506 8000
7507 return ts ? ts->style_text : NULL; 8001 o->default_format.default_style_str = _format_string_get(eo_obj, &(o->default_format.format));
8002 return o->default_format.default_style_str;
7508} 8003}
7509 8004
7510EOLIAN static void 8005EOLIAN static void
@@ -13767,6 +14262,9 @@ evas_object_textblock_free(Evas_Object *eo_obj)
13767 if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters); 14262 if (o->bidi_delimiters) eina_stringshare_del(o->bidi_delimiters);
13768 _format_command_shutdown(); 14263 _format_command_shutdown();
13769 14264
14265 if (o->default_format.default_style_str)
14266 free(o->default_format.default_style_str);
14267
13770 /* remove obstacles */ 14268 /* remove obstacles */
13771 _obstacles_free(eo_obj, o); 14269 _obstacles_free(eo_obj, o);
13772 14270
diff --git a/src/lib/evas/common/evas_font.h b/src/lib/evas/common/evas_font.h
index e167855..4588a31 100644
--- a/src/lib/evas/common/evas_font.h
+++ b/src/lib/evas/common/evas_font.h
@@ -410,7 +410,8 @@ void evas_font_free(void *font);
410void evas_fonts_zero_free(); 410void evas_fonts_zero_free();
411void evas_fonts_zero_pressure(); 411void evas_fonts_zero_pressure();
412void evas_font_name_parse(Evas_Font_Description *fdesc, const char *name); 412void evas_font_name_parse(Evas_Font_Description *fdesc, const char *name);
413int evas_font_style_find(const char *start, const char *end, Evas_Font_Style style); 413unsigned int evas_font_style_find(const char *start, const char *end, Evas_Font_Style style);
414const char *evas_font_style_find_str(int type, Evas_Font_Style style);
414Evas_Font_Description *evas_font_desc_new(void); 415Evas_Font_Description *evas_font_desc_new(void);
415Evas_Font_Description *evas_font_desc_dup(const Evas_Font_Description *fdesc); 416Evas_Font_Description *evas_font_desc_dup(const Evas_Font_Description *fdesc);
416void evas_font_desc_unref(Evas_Font_Description *fdesc); 417void evas_font_desc_unref(Evas_Font_Description *fdesc);
diff --git a/src/tests/evas/evas_test_textblock.c b/src/tests/evas/evas_test_textblock.c
index 163d403..fbeba49 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -4350,6 +4350,9 @@ EFL_START_TEST(evas_textblock_annotation)
4350} 4350}
4351EFL_END_TEST; 4351EFL_END_TEST;
4352 4352
4353static const char *efl_style_buf =
4354 "" TEST_FONT " font_size=10 color=#000 text_class=entry";
4355
4353#define START_EFL_CANVAS_TEXT_TEST() \ 4356#define START_EFL_CANVAS_TEXT_TEST() \
4354 Evas *evas; \ 4357 Evas *evas; \
4355 Eo *txt; \ 4358 Eo *txt; \
@@ -4360,9 +4363,8 @@ EFL_END_TEST;
4360 txt = efl_add(EFL_CANVAS_TEXT_CLASS, evas); \ 4363 txt = efl_add(EFL_CANVAS_TEXT_CLASS, evas); \
4361 fail_if(!txt); \ 4364 fail_if(!txt); \
4362 efl_canvas_text_newline_as_paragraph_separator_set(txt, EINA_FALSE); \ 4365 efl_canvas_text_newline_as_paragraph_separator_set(txt, EINA_FALSE); \
4363 efl_canvas_text_style_set(txt, NULL, style_buf); \ 4366 efl_canvas_text_style_apply(txt, efl_style_buf); \
4364 fail_if(!efl_canvas_text_style_get(txt, NULL) || \ 4367 fail_if(!efl_canvas_text_all_styles_get(txt)); \
4365 strcmp(style_buf, efl_canvas_text_style_get(txt, NULL))); \
4366 cur_obj = efl_canvas_text_cursor_create(txt);\ 4368 cur_obj = efl_canvas_text_cursor_create(txt);\
4367 cur = evas_object_textblock_cursor_new(txt); \ 4369 cur = evas_object_textblock_cursor_new(txt); \
4368 fail_if(!cur); \ 4370 fail_if(!cur); \
@@ -4547,6 +4549,56 @@ EFL_START_TEST(efl_text_font)
4547} 4549}
4548EFL_END_TEST 4550EFL_END_TEST
4549 4551
4552EFL_START_TEST(efl_canvas_text_style)
4553{
4554 START_EFL_CANVAS_TEXT_TEST();
4555 unsigned char r, g, b, a;
4556 const char *style;
4557
4558 efl_text_password_set(txt, EINA_FALSE);
4559 efl_text_underline_type_set(txt, EFL_TEXT_STYLE_UNDERLINE_TYPE_DOUBLE);
4560 efl_text_font_weight_set(txt, EFL_TEXT_FONT_WEIGHT_EXTRABOLD);
4561 efl_text_font_slant_set(txt, EFL_TEXT_FONT_SLANT_OBLIQUE);
4562 efl_text_tabstops_set(txt, 20);
4563
4564 efl_canvas_text_style_apply(txt, "color=#90E135");
4565
4566 style = efl_canvas_text_all_styles_get(txt);
4567
4568 // from efl_style_buf
4569 fail_if(!strstr(style, "font=DejaVuSans,UnDotum,malayalam"));
4570 // default value
4571 fail_if(!strstr(style, "font_width=normal"));
4572
4573 // from functions
4574 fail_if(!strstr(style, "font_weight=extrabold"));
4575 fail_if(!strstr(style, "tabstops=20"));
4576 fail_if(!strstr(style, "color=rgba(144,225,53,255)"));
4577 fail_if(!strstr(style, "password=off"));
4578 efl_text_password_set(txt, EINA_TRUE);
4579 style = efl_canvas_text_all_styles_get(txt);
4580 fail_if(!strstr(style, "password=on"));
4581
4582 efl_canvas_text_style_apply(txt, "font_width=ultracondensed");
4583 ck_assert_int_eq(efl_text_font_width_get(txt), EFL_TEXT_FONT_WIDTH_ULTRACONDENSED);
4584
4585 efl_canvas_text_style_apply(txt, "wrap=none");
4586 ck_assert_int_eq(efl_text_wrap_get(txt), EFL_TEXT_FORMAT_WRAP_NONE);
4587
4588 efl_canvas_text_style_apply(txt, "backing=on");
4589 ck_assert_int_eq(efl_text_backing_type_get(txt), EFL_TEXT_STYLE_BACKING_TYPE_ENABLED);
4590
4591 efl_canvas_text_style_apply(txt, "color=#EF596C");
4592 efl_text_normal_color_get(txt, &r, &g, &b, &a);
4593 ck_assert_int_eq(r, 0xEF);
4594 ck_assert_int_eq(g, 0x59);
4595 ck_assert_int_eq(b, 0x6C);
4596 ck_assert_int_eq(a, 0xFF);
4597
4598 END_EFL_CANVAS_TEXT_TEST();
4599}
4600EFL_END_TEST
4601
4550void evas_test_textblock(TCase *tc) 4602void evas_test_textblock(TCase *tc)
4551{ 4603{
4552 tcase_add_test(tc, evas_textblock_simple); 4604 tcase_add_test(tc, evas_textblock_simple);
@@ -4581,5 +4633,6 @@ void evas_test_textblock(TCase *tc)
4581 tcase_add_test(tc, efl_canvas_text_markup); 4633 tcase_add_test(tc, efl_canvas_text_markup);
4582 tcase_add_test(tc, efl_canvas_text_markup_invalid_escape); 4634 tcase_add_test(tc, efl_canvas_text_markup_invalid_escape);
4583 tcase_add_test(tc, efl_text_font); 4635 tcase_add_test(tc, efl_text_font);
4636 tcase_add_test(tc, efl_canvas_text_style);
4584} 4637}
4585 4638