summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <hirt.danny@gmail.com>2017-05-22 18:02:43 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2017-05-28 15:34:26 +0300
commit9289e082d86d841f329f72b4074a674961ad7ca4 (patch)
tree720a639bee1cc3c1282bbdbdb6bb68c45a415e5b
parentda2ef30f2b4d53aa3c1658b83c8c8381743469a0 (diff)
Canvas text: implement Font, Format and Style interfaces
This replaces the 'style' API with actual properties. @feature
-rw-r--r--src/lib/evas/canvas/efl_canvas_text.eo39
-rw-r--r--src/lib/evas/canvas/evas_object_textblock.c757
2 files changed, 772 insertions, 24 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_text.eo b/src/lib/evas/canvas/efl_canvas_text.eo
index 34d28a2c37..3822d52a1c 100644
--- a/src/lib/evas/canvas/efl_canvas_text.eo
+++ b/src/lib/evas/canvas/efl_canvas_text.eo
@@ -1,6 +1,7 @@
1struct Efl.Canvas.Text.Style; [[EFL text style data structure]] 1struct Efl.Canvas.Text.Style; [[EFL text style data structure]]
2 2
3class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text, Efl.Canvas.Filter.Internal) 3class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text, Efl.Text.Properties, Efl.Canvas.Filter.Internal,
4Efl.Text.Font, Efl.Text.Style, Efl.Text.Format)
4{ 5{
5 [[Efl canvas text class]] 6 [[Efl canvas text class]]
6 legacy_prefix: evas_object_textblock; 7 legacy_prefix: evas_object_textblock;
@@ -372,6 +373,42 @@ class Efl.Canvas.Text (Efl.Canvas.Object, Efl.Text, Efl.Canvas.Filter.Internal)
372 Efl.Canvas.Filter.Internal.filter_dirty; 373 Efl.Canvas.Filter.Internal.filter_dirty;
373 Efl.Canvas.Filter.Internal.filter_input_render; 374 Efl.Canvas.Filter.Internal.filter_input_render;
374 Efl.Canvas.Filter.Internal.filter_state_prepare; 375 Efl.Canvas.Filter.Internal.filter_state_prepare;
376 Efl.Text.Font.font { get; set; }
377 Efl.Text.Font.font_source { get; set; }
378 Efl.Text.Font.font_fallbacks { get; set; }
379 Efl.Text.Font.font_lang { get; set; }
380 Efl.Text.Font.font_weight { get; set; }
381 Efl.Text.Font.font_slant { get; set; }
382 Efl.Text.Font.font_width { get; set; }
383 Efl.Text.Style.normal_color { get; set; }
384 Efl.Text.Style.backing_type { get; set; }
385 Efl.Text.Style.backing_color { get; set; }
386 Efl.Text.Style.underline_type { get; set; }
387 Efl.Text.Style.underline_color { get; set; }
388 Efl.Text.Style.underline_height { get; set; }
389 Efl.Text.Style.underline_dashed_color { get; set; }
390 Efl.Text.Style.underline_dashed_width { get; set; }
391 Efl.Text.Style.underline_dashed_gap { get; set; }
392 Efl.Text.Style.underline2_type { get; set; }
393 Efl.Text.Style.underline2_color { get; set; }
394 Efl.Text.Style.strikethrough_type { get; set; }
395 Efl.Text.Style.strikethrough_color { get; set; }
396 Efl.Text.Style.effect_type { get; set; }
397 Efl.Text.Style.outline_color { get; set; }
398 Efl.Text.Style.shadow_direction { get; set; }
399 Efl.Text.Style.shadow_color { get; set; }
400 Efl.Text.Style.glow_color { get; set; }
401 Efl.Text.Style.glow2_color { get; set; }
402 Efl.Text.Format.format_ellipsis { get; set; }
403 Efl.Text.Format.format_wrap { get; set; }
404 Efl.Text.Format.format_multiline { get; set; }
405 Efl.Text.Format.format_halign { get; set; }
406 Efl.Text.Format.format_valign { get; set; }
407 Efl.Text.Format.format_linegap { get; set; }
408 Efl.Text.Format.format_linerelgap { get; set; }
409 Efl.Text.Format.format_tabstops { get; set; }
410 Efl.Text.Format.format_password { get; set; }
411 Efl.Text.Format.format_replacement_char { get; set; }
375 } 412 }
376 events { 413 events {
377 changed; [[Called when the content (text or annotations) changed.]] 414 changed; [[Called when the content (text or annotations) changed.]]
diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c
index 183d0439de..43369148bd 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -569,6 +569,9 @@ struct _Efl_Canvas_Text_Annotation
569 Eina_Bool is_item : 1; /**< indicates it is an item/object placeholder */ 569 Eina_Bool is_item : 1; /**< indicates it is an item/object placeholder */
570}; 570};
571 571
572#define _FMT(x) (o->default_format.format.x)
573#define _FMT_INFO(x) (o->default_format.info.x)
574
572/* Size of the index array */ 575/* Size of the index array */
573#define TEXTBLOCK_PAR_INDEX_SIZE 10 576#define TEXTBLOCK_PAR_INDEX_SIZE 10
574struct _Evas_Object_Textblock 577struct _Evas_Object_Textblock
@@ -595,6 +598,22 @@ struct _Evas_Object_Textblock
595 struct { 598 struct {
596 int l, r, t, b; 599 int l, r, t, b;
597 } style_pad; 600 } style_pad;
601 struct {
602 Evas_Object_Textblock_Format format;
603 struct {
604 Eina_Stringshare *font;
605 Evas_Font_Size size;
606 Eina_Stringshare *font_source;
607 Eina_Stringshare *font_fallbacks;
608 Eina_Stringshare *font_lang;
609 unsigned int font_weight;
610 unsigned int font_slant;
611 unsigned int font_width;
612 Efl_Text_Style_Effect_Type effect;
613 Efl_Text_Style_Shadow_Direction shadow_direction;
614 Efl_Text_Format_Wrap wrap;
615 } info;
616 } default_format;
598 double valign; 617 double valign;
599 Eina_Stringshare *markup_text; 618 Eina_Stringshare *markup_text;
600 char *utf8; 619 char *utf8;
@@ -622,6 +641,8 @@ struct _Evas_Object_Textblock
622 Eina_Bool legacy_newline : 1; 641 Eina_Bool legacy_newline : 1;
623 Eina_Bool inherit_paragraph_direction : 1; 642 Eina_Bool inherit_paragraph_direction : 1;
624 Eina_Bool changed_paragraph_direction : 1; 643 Eina_Bool changed_paragraph_direction : 1;
644 Eina_Bool multiline : 1;
645 Eina_Bool wrap_changed : 1;
625}; 646};
626 647
627struct _Evas_Textblock_Selection_Iterator 648struct _Evas_Textblock_Selection_Iterator
@@ -3292,6 +3313,8 @@ static Evas_Object_Textblock_Format *
3292_layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt, 3313_layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
3293 Evas_Object_Textblock_Node_Format *fnode) 3314 Evas_Object_Textblock_Node_Format *fnode)
3294{ 3315{
3316 Efl_Canvas_Text_Data *o = c->o;
3317
3295 if (fmt) 3318 if (fmt)
3296 { 3319 {
3297 fmt = _format_dup(c->obj, fmt); 3320 fmt = _format_dup(c->obj, fmt);
@@ -3302,22 +3325,36 @@ _layout_format_push(Ctxt *c, Evas_Object_Textblock_Format *fmt,
3302 { 3325 {
3303 fmt = calloc(1, sizeof(Evas_Object_Textblock_Format)); 3326 fmt = calloc(1, sizeof(Evas_Object_Textblock_Format));
3304 c->format_stack = eina_list_prepend(c->format_stack, fmt); 3327 c->format_stack = eina_list_prepend(c->format_stack, fmt);
3328 *fmt = c->o->default_format.format;
3305 fmt->ref = 1; 3329 fmt->ref = 1;
3306 fmt->halign = 0.0; 3330
3307 fmt->halign_auto = EINA_TRUE; 3331 // Apply font if specified
3308 fmt->valign = -1.0; 3332 if (_FMT_INFO(font))
3309 fmt->style = EVAS_TEXT_STYLE_PLAIN; 3333 {
3310 fmt->tabstops = 32; 3334 Evas_Object_Protected_Data *evas_obj = efl_data_scope_get(c->obj, EFL_CANVAS_OBJECT_CLASS);
3311 fmt->linesize = 0; 3335
3312 fmt->linerelsize = 0.0; 3336 if (fmt->font.fdesc)
3313 fmt->linegap = 0; 3337 {
3314 fmt->underline_dash_width = 6; 3338 evas_font_desc_unref(fmt->font.fdesc);
3315 fmt->underline_dash_gap = 2; 3339 }
3316 fmt->underline_height = 1.0; 3340 fmt->font.fdesc = evas_font_desc_new();
3317 fmt->linerelgap = 0.0; 3341
3318 fmt->password = 1; 3342 evas_font_name_parse(fmt->font.fdesc, _FMT_INFO(font));
3319 fmt->ellipsis = -1; 3343 eina_stringshare_replace(&(fmt->font.fdesc->lang),
3344 evas_font_lang_normalize("auto"));
3345 eina_stringshare_replace(&(fmt->font.fdesc->fallbacks),
3346 _FMT_INFO(font_fallbacks));
3347
3348 fmt->font.size = _FMT_INFO(size);
3349 fmt->font.fdesc->weight = _FMT_INFO(font_weight);
3350 fmt->font.fdesc->slant = _FMT_INFO(font_slant);
3351 fmt->font.fdesc->width = _FMT_INFO(font_width);
3352 fmt->font.fdesc->lang = _FMT_INFO(font_lang);
3353 fmt->font.font = evas_font_load(evas_obj->layer->evas->evas, fmt->font.fdesc,
3354 fmt->font.source, (int)(((double) _FMT_INFO(size)) * evas_obj->cur->scale));
3355 }
3320 } 3356 }
3357
3321 return fmt; 3358 return fmt;
3322} 3359}
3323 3360
@@ -5400,7 +5437,8 @@ _layout_par(Ctxt *c)
5400 * and we aren't just calculating. */ 5437 * and we aren't just calculating. */
5401 if (!c->par->text_node->is_new && !c->par->text_node->dirty && 5438 if (!c->par->text_node->is_new && !c->par->text_node->dirty &&
5402 !c->width_changed && c->par->lines && 5439 !c->width_changed && c->par->lines &&
5403 !c->o->have_ellipsis && !c->o->obstacle_changed) 5440 !c->o->have_ellipsis && !c->o->obstacle_changed &&
5441 !c->o->wrap_changed)
5404 { 5442 {
5405 Evas_Object_Textblock_Line *ln; 5443 Evas_Object_Textblock_Line *ln;
5406 /* Update c->line_no */ 5444 /* Update c->line_no */
@@ -5575,7 +5613,8 @@ _layout_par(Ctxt *c)
5575 ((c->y + ellip_h_thresh > 5613 ((c->y + ellip_h_thresh >
5576 c->h - c->o->style_pad.t - c->o->style_pad.b) || 5614 c->h - c->o->style_pad.t - c->o->style_pad.b) ||
5577 (!it->format->wrap_word && !it->format->wrap_char && 5615 (!it->format->wrap_word && !it->format->wrap_char &&
5578 !it->format->wrap_mixed && !it->format->wrap_hyphenation))) 5616 !it->format->wrap_mixed && !it->format->wrap_hyphenation) ||
5617 !c->o->multiline))
5579 { 5618 {
5580 _layout_handle_ellipsis(c, it, i); 5619 _layout_handle_ellipsis(c, it, i);
5581 ret = 1; 5620 ret = 1;
@@ -5583,7 +5622,8 @@ _layout_par(Ctxt *c)
5583 } 5622 }
5584 /* If we want to wrap and it's worth checking for wrapping 5623 /* If we want to wrap and it's worth checking for wrapping
5585 * (i.e there's actually text). */ 5624 * (i.e there's actually text). */
5586 else if (((wrap > 0) || it->format->wrap_word || it->format->wrap_char || 5625 else if (c->o->multiline &&
5626 ((wrap > 0) || it->format->wrap_word || it->format->wrap_char ||
5587 it->format->wrap_mixed || it->format->wrap_hyphenation) && it->text_node) 5627 it->format->wrap_mixed || it->format->wrap_hyphenation) && it->text_node)
5588 { 5628 {
5589 size_t line_start; 5629 size_t line_start;
@@ -5805,7 +5845,8 @@ _layout_par(Ctxt *c)
5805 /* If it's a newline, and we are not in newline compat 5845 /* If it's a newline, and we are not in newline compat
5806 * mode, or we are in newline compat mode, and this is 5846 * mode, or we are in newline compat mode, and this is
5807 * not used as a paragraph separator, advance */ 5847 * not used as a paragraph separator, advance */
5808 if (fi->item && _IS_LINE_SEPARATOR(fi->item) && 5848 if (c->o->multiline &&
5849 fi->item && _IS_LINE_SEPARATOR(fi->item) &&
5809 (!c->o->legacy_newline || 5850 (!c->o->legacy_newline ||
5810 eina_list_next(i))) 5851 eina_list_next(i)))
5811 { 5852 {
@@ -6263,6 +6304,11 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
6263 Eina_List *itr; 6304 Eina_List *itr;
6264 Evas_Textblock_Style *style; 6305 Evas_Textblock_Style *style;
6265 Eina_Bool finalize = EINA_FALSE; 6306 Eina_Bool finalize = EINA_FALSE;
6307 if (!c->fmt)
6308 {
6309 c->fmt = _layout_format_push(c, NULL, NULL);
6310 finalize = EINA_TRUE;
6311 }
6266 if ((c->o->style) && (c->o->style->default_tag)) 6312 if ((c->o->style) && (c->o->style->default_tag))
6267 { 6313 {
6268 c->fmt = _layout_format_push(c, NULL, NULL); 6314 c->fmt = _layout_format_push(c, NULL, NULL);
@@ -6274,10 +6320,6 @@ _layout(const Evas_Object *eo_obj, int w, int h, int *w_ret, int *h_ret)
6274 { 6320 {
6275 if ((style) && (style->default_tag)) 6321 if ((style) && (style->default_tag))
6276 { 6322 {
6277 if (!c->fmt)
6278 {
6279 c->fmt = _layout_format_push(c, NULL, NULL);
6280 }
6281 _format_fill(c->obj, c->fmt, style->default_tag); 6323 _format_fill(c->obj, c->fmt, style->default_tag);
6282 finalize = EINA_TRUE; 6324 finalize = EINA_TRUE;
6283 } 6325 }
@@ -6429,6 +6471,7 @@ _relayout(const Evas_Object *eo_obj)
6429 o->formatted.valid = 1; 6471 o->formatted.valid = 1;
6430 o->formatted.oneline_h = 0; 6472 o->formatted.oneline_h = 0;
6431 o->last_w = obj->cur->geometry.w; 6473 o->last_w = obj->cur->geometry.w;
6474 o->wrap_changed = EINA_FALSE;
6432 LYDBG("ZZ: --------- layout %p @ %ix%i = %ix%i\n", eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, o->formatted.w, o->formatted.h); 6475 LYDBG("ZZ: --------- layout %p @ %ix%i = %ix%i\n", eo_obj, obj->cur->geometry.w, obj->cur->geometry.h, o->formatted.w, o->formatted.h);
6433 o->last_h = obj->cur->geometry.h; 6476 o->last_h = obj->cur->geometry.h;
6434 if ((o->paragraphs) && (!EINA_INLIST_GET(o->paragraphs)->next) && 6477 if ((o->paragraphs) && (!EINA_INLIST_GET(o->paragraphs)->next) &&
@@ -6559,7 +6602,8 @@ evas_object_textblock_add(Evas *e)
6559 MAGIC_CHECK(e, Evas, MAGIC_EVAS); 6602 MAGIC_CHECK(e, Evas, MAGIC_EVAS);
6560 return NULL; 6603 return NULL;
6561 MAGIC_CHECK_END(); 6604 MAGIC_CHECK_END();
6562 Evas_Object *eo_obj = efl_add(MY_CLASS, e); 6605 Evas_Object *eo_obj = efl_add(MY_CLASS, e,
6606 efl_text_format_multiline_set(efl_added, EINA_TRUE));
6563 return eo_obj; 6607 return eo_obj;
6564} 6608}
6565 6609
@@ -6583,6 +6627,22 @@ _efl_canvas_text_efl_object_constructor(Eo *eo_obj, Efl_Canvas_Text_Data *class_
6583 _format_command_init(); 6627 _format_command_init();
6584 evas_object_textblock_init(eo_obj); 6628 evas_object_textblock_init(eo_obj);
6585 6629
6630 _FMT(ref) = 1;
6631 _FMT(halign) = 0.0;
6632 _FMT(halign_auto) = EINA_TRUE;
6633 _FMT(valign) = -1.0;
6634 _FMT(style) = EVAS_TEXT_STYLE_PLAIN;
6635 _FMT(tabstops) = 32;
6636 _FMT(linesize) = 0;
6637 _FMT(linerelsize) = 0.0;
6638 _FMT(linegap) = 0;
6639 _FMT(underline_dash_width) = 6;
6640 _FMT(underline_dash_gap) = 2;
6641 _FMT(underline_height) = 1.0;
6642 _FMT(linerelgap) = 0.0;
6643 _FMT(password) = 1;
6644 _FMT(ellipsis) = -1;
6645
6586 return eo_obj; 6646 return eo_obj;
6587} 6647}
6588 6648
@@ -12892,6 +12952,7 @@ evas_object_textblock_init(Evas_Object *eo_obj)
12892 evas_object_textblock_text_markup_set(eo_obj, ""); 12952 evas_object_textblock_text_markup_set(eo_obj, "");
12893 12953
12894 o->legacy_newline = EINA_TRUE; 12954 o->legacy_newline = EINA_TRUE;
12955 o->multiline = EINA_FALSE;
12895#ifdef BIDI_SUPPORT 12956#ifdef BIDI_SUPPORT
12896 o->inherit_paragraph_direction = EINA_TRUE; 12957 o->inherit_paragraph_direction = EINA_TRUE;
12897#endif 12958#endif
@@ -14828,6 +14889,656 @@ _efl_canvas_text_annotation_positions_get(Eo *eo_obj,
14828 _textblock_cursor_pos_at_fnode_set(eo_obj, end, annotation->end_node); 14889 _textblock_cursor_pos_at_fnode_set(eo_obj, end, annotation->end_node);
14829} 14890}
14830 14891
14892static void
14893_canvas_text_format_changed(Eo *eo_obj, Efl_Canvas_Text_Data *o)
14894{
14895 o->format_changed = EINA_TRUE;
14896 _evas_textblock_invalidate_all(o);
14897 _evas_textblock_changed(o, eo_obj);
14898 efl_event_callback_call(eo_obj, EFL_CANVAS_TEXT_EVENT_CHANGED, NULL);
14899}
14900
14901/* Efl.Text.Font interface implementation */
14902
14903static void
14904_efl_canvas_text_efl_text_font_font_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font EINA_UNUSED, int size EINA_UNUSED)
14905{
14906 Eina_Bool changed = EINA_FALSE;
14907
14908 Eina_Stringshare *nfont;
14909
14910 if (o->default_format.info.size != size)
14911 {
14912 o->default_format.info.size = size;
14913 changed = EINA_TRUE;
14914 }
14915
14916 if (o->default_format.info.font != font)
14917 {
14918 nfont = eina_stringshare_add(font);
14919 if (nfont == _FMT_INFO(font))
14920 {
14921 /* Already stringshared here, unref */
14922 eina_stringshare_del(nfont);
14923 }
14924 else
14925 {
14926 // Set immediately, load font later
14927 _FMT_INFO(font) = nfont;
14928 changed = EINA_TRUE;
14929 }
14930 }
14931
14932 if (changed)
14933 {
14934 _canvas_text_format_changed(obj, o);
14935 }
14936}
14937
14938static void
14939_efl_canvas_text_efl_text_font_font_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char **font EINA_UNUSED, int *size EINA_UNUSED)
14940{
14941 if (font) *font = o->default_format.info.font;
14942 if (size) *size = o->default_format.info.size;
14943}
14944
14945static void
14946_efl_canvas_text_efl_text_font_font_source_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_source EINA_UNUSED)
14947{
14948 Eina_Stringshare *nfont_source;
14949 if (o->default_format.info.font_source != font_source)
14950 {
14951 nfont_source = eina_stringshare_add(font_source);
14952 if (nfont_source == _FMT_INFO(font_source))
14953 {
14954 /* Already stringshared here, unref */
14955 eina_stringshare_del(nfont_source);
14956 }
14957 else
14958 {
14959 // Set immediately, load font_source later
14960 _FMT_INFO(font_source) = nfont_source;
14961 _canvas_text_format_changed(obj, o);
14962 }
14963 }
14964}
14965
14966static const char*
14967_efl_canvas_text_efl_text_font_font_source_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
14968{
14969 return _FMT_INFO(font_source);
14970}
14971
14972static void
14973_efl_canvas_text_efl_text_font_font_fallbacks_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_fallbacks EINA_UNUSED)
14974{
14975 Eina_Stringshare *nfont_fallbacks;
14976 if (o->default_format.info.font_fallbacks != font_fallbacks)
14977 {
14978 nfont_fallbacks = eina_stringshare_add(font_fallbacks);
14979 if (nfont_fallbacks == _FMT_INFO(font_fallbacks))
14980 {
14981 /* Already stringshared here, unref */
14982 eina_stringshare_del(nfont_fallbacks);
14983 }
14984 else
14985 {
14986 // Set immediately, load font_fallbacks later
14987 _FMT_INFO(font_fallbacks) = nfont_fallbacks;
14988 _canvas_text_format_changed(obj, o);
14989 }
14990 }
14991}
14992
14993static const char*
14994_efl_canvas_text_efl_text_font_font_fallbacks_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
14995{
14996 return _FMT_INFO(font_fallbacks);
14997}
14998
14999static void
15000_efl_canvas_text_efl_text_font_font_lang_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *font_lang EINA_UNUSED)
15001{
15002 Eina_Stringshare *nfont_lang;
15003 if (o->default_format.info.font_lang != font_lang)
15004 {
15005 nfont_lang = eina_stringshare_add(font_lang);
15006 if (nfont_lang == _FMT_INFO(font_lang))
15007 {
15008 /* Already stringshared here, unref */
15009 eina_stringshare_del(nfont_lang);
15010 }
15011 else
15012 {
15013 // Set immediately, load font_lang later
15014 _FMT_INFO(font_lang) = nfont_lang;
15015 _canvas_text_format_changed(obj, o);
15016 }
15017 }
15018}
15019
15020static const char*
15021_efl_canvas_text_efl_text_font_font_lang_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15022{
15023 return _FMT_INFO(font_lang);
15024}
15025
15026static void
15027_efl_canvas_text_efl_text_font_font_weight_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Weight font_weight EINA_UNUSED)
15028{
15029 if (_FMT_INFO(font_weight) == font_weight) return;
15030 _FMT_INFO(font_weight) = font_weight;
15031 _canvas_text_format_changed(obj, o);
15032}
15033
15034static Efl_Text_Font_Weight
15035_efl_canvas_text_efl_text_font_font_weight_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15036{
15037 return _FMT_INFO(font_weight);
15038}
15039
15040static void
15041_efl_canvas_text_efl_text_font_font_slant_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Slant font_slant EINA_UNUSED)
15042{
15043 if (_FMT_INFO(font_slant) == font_slant) return;
15044 _FMT_INFO(font_slant) = font_slant;
15045 _canvas_text_format_changed(obj, o);
15046}
15047
15048static Efl_Text_Font_Slant
15049_efl_canvas_text_efl_text_font_font_slant_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15050{
15051 return _FMT_INFO(font_slant);
15052}
15053
15054static void
15055_efl_canvas_text_efl_text_font_font_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Font_Width font_width EINA_UNUSED)
15056{
15057 if (_FMT_INFO(font_width) == font_width) return;
15058 _FMT_INFO(font_width) = font_width;
15059 _canvas_text_format_changed(obj, o);
15060}
15061
15062static Efl_Text_Font_Width
15063_efl_canvas_text_efl_text_font_font_width_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15064{
15065 return _FMT_INFO(font_width);
15066}
15067
15068/* Efl.Text.Style interface implementation */
15069
15070/* Helper: sets color fields of style 'x' and informs if any are changed. */
15071#define _FMT_COLOR_SET(x) \
15072 if ((_FMT(color.x).r == r) && (_FMT(color.x).g == g) \
15073 && (_FMT(color.x).b == b) && (_FMT(color.x).a == a)) return; \
15074 _FMT(color.x).r = r; \
15075 _FMT(color.x).g = g; \
15076 _FMT(color.x).b = b; \
15077 _FMT(color.x).a = a; \
15078 _canvas_text_format_changed(obj, o);
15079
15080/* Helper: returns color fields of style 'x'. */
15081#define _FMT_COLOR_RET(x) \
15082 if (r) *r = _FMT(color.x).r; \
15083 if (g) *g = _FMT(color.x).g; \
15084 if (b) *b = _FMT(color.x).b; \
15085 if (a) *a = _FMT(color.x).a;
15086
15087/* Helper: updates format field, and informs if changed. */
15088#define _FMT_SET(x, v) \
15089 if (_FMT(x) == v) return; \
15090 _FMT(x) = v; \
15091 _canvas_text_format_changed(obj, o);
15092
15093/* Helper: updates format field of extended format information, and informs if changed. */
15094#define _FMT_INFO_SET_START(x, v) \
15095 Eina_Bool changed = EINA_FALSE; \
15096 if (_FMT_INFO(x) == v) return; \
15097 changed = EINA_TRUE; \
15098 _FMT_INFO(x) = v; \
15099
15100#define _FMT_INFO_SET_END() \
15101 if (changed) _canvas_text_format_changed(obj, o);
15102
15103static void
15104_efl_canvas_text_efl_text_style_normal_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15105{
15106 _FMT_COLOR_SET(normal);
15107}
15108
15109static void
15110_efl_canvas_text_efl_text_style_normal_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15111{
15112 _FMT_COLOR_RET(normal);
15113}
15114
15115static void
15116_efl_canvas_text_efl_text_style_backing_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Backing_Type type EINA_UNUSED)
15117{
15118 _FMT_SET(backing, type);
15119}
15120
15121static Efl_Text_Style_Backing_Type
15122_efl_canvas_text_efl_text_style_backing_type_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15123{
15124 return _FMT(backing);
15125}
15126
15127static void
15128_efl_canvas_text_efl_text_style_backing_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15129{
15130 _FMT_COLOR_SET(backing);
15131}
15132
15133static void
15134_efl_canvas_text_efl_text_style_backing_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15135{
15136 _FMT_COLOR_RET(backing);
15137}
15138
15139static void
15140_efl_canvas_text_efl_text_style_underline_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED)
15141{
15142 _FMT_SET(underline, type);
15143}
15144
15145static Efl_Text_Style_Underline_Type
15146_efl_canvas_text_efl_text_style_underline_type_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15147{
15148 return _FMT(underline);
15149}
15150
15151static void
15152_efl_canvas_text_efl_text_style_underline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15153{
15154 _FMT_COLOR_SET(underline);
15155}
15156
15157static void
15158_efl_canvas_text_efl_text_style_underline_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15159{
15160 _FMT_COLOR_RET(underline);
15161}
15162
15163static void
15164_efl_canvas_text_efl_text_style_underline_height_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double height EINA_UNUSED)
15165{
15166 _FMT_SET(underline_height, height);
15167}
15168
15169static double
15170_efl_canvas_text_efl_text_style_underline_height_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15171{
15172 return _FMT(underline_height);
15173}
15174
15175static void
15176_efl_canvas_text_efl_text_style_underline_dashed_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15177{
15178 _FMT_COLOR_SET(underline_dash);
15179}
15180
15181static void
15182_efl_canvas_text_efl_text_style_underline_dashed_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15183{
15184 _FMT_COLOR_RET(underline_dash);
15185}
15186
15187static void
15188_efl_canvas_text_efl_text_style_underline_dashed_width_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, int width EINA_UNUSED)
15189{
15190 _FMT_SET(underline_dash_width, width);
15191}
15192
15193static int
15194_efl_canvas_text_efl_text_style_underline_dashed_width_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15195{
15196 return _FMT(underline_dash_width);
15197}
15198
15199static void
15200_efl_canvas_text_efl_text_style_underline_dashed_gap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, int gap EINA_UNUSED)
15201{
15202 _FMT_SET(underline_dash_gap, gap);
15203}
15204
15205static int
15206_efl_canvas_text_efl_text_style_underline_dashed_gap_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15207{
15208 return _FMT(underline_dash_width);
15209}
15210
15211static void
15212_efl_canvas_text_efl_text_style_underline2_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Underline_Type type EINA_UNUSED)
15213{
15214 _FMT_SET(underline2, type);
15215}
15216
15217static Efl_Text_Style_Underline_Type
15218_efl_canvas_text_efl_text_style_underline2_type_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15219{
15220 return _FMT(underline2);
15221}
15222
15223static void
15224_efl_canvas_text_efl_text_style_underline2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15225{
15226 _FMT_COLOR_SET(underline2);
15227}
15228
15229static void
15230_efl_canvas_text_efl_text_style_underline2_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15231{
15232 _FMT_COLOR_RET(underline2);
15233}
15234
15235static void
15236_efl_canvas_text_efl_text_style_strikethrough_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Strikethrough_Type type EINA_UNUSED)
15237{
15238 _FMT_SET(strikethrough, type);
15239}
15240
15241static Efl_Text_Style_Strikethrough_Type
15242_efl_canvas_text_efl_text_style_strikethrough_type_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15243{
15244 return _FMT(strikethrough);
15245}
15246
15247static void
15248_efl_canvas_text_efl_text_style_strikethrough_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15249{
15250 _FMT_COLOR_SET(strikethrough);
15251}
15252
15253static void
15254_efl_canvas_text_efl_text_style_strikethrough_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15255{
15256 _FMT_COLOR_RET(strikethrough);
15257}
15258
15259static const struct
15260{
15261 Efl_Text_Style_Effect_Type x;
15262 Evas_Text_Style_Type y;
15263} _map_style_effect[] = {
15264 { EFL_TEXT_STYLE_EFFECT_TYPE_NONE, EVAS_TEXT_STYLE_PLAIN },
15265 { EFL_TEXT_STYLE_EFFECT_TYPE_SHADOW, EVAS_TEXT_STYLE_SHADOW },
15266 { EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE, EVAS_TEXT_STYLE_OUTLINE },
15267 { EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_OUTLINE, EVAS_TEXT_STYLE_SOFT_OUTLINE },
15268 { EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SHADOW, EVAS_TEXT_STYLE_OUTLINE_SHADOW },
15269 { EFL_TEXT_STYLE_EFFECT_TYPE_OUTLINE_SOFT_SHADOW, EVAS_TEXT_STYLE_OUTLINE_SOFT_SHADOW },
15270 { EFL_TEXT_STYLE_EFFECT_TYPE_GLOW, EVAS_TEXT_STYLE_GLOW },
15271 { EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SHADOW, EVAS_TEXT_STYLE_FAR_SHADOW },
15272 { EFL_TEXT_STYLE_EFFECT_TYPE_SOFT_SHADOW, EVAS_TEXT_STYLE_SOFT_SHADOW },
15273 { EFL_TEXT_STYLE_EFFECT_TYPE_FAR_SOFT_SHADOW, EVAS_TEXT_STYLE_FAR_SOFT_SHADOW },
15274};
15275
15276static const struct
15277{
15278 Efl_Text_Style_Shadow_Direction x;
15279 Evas_Text_Style_Type y;
15280} _map_shadow_dir[] = {
15281 { EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_RIGHT },
15282 { EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM },
15283 { EFL_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_BOTTOM_LEFT },
15284 { EFL_TEXT_STYLE_SHADOW_DIRECTION_LEFT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_LEFT },
15285 { EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_LEFT },
15286 { EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP },
15287 { EFL_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_TOP_RIGHT },
15288 { EFL_TEXT_STYLE_SHADOW_DIRECTION_RIGHT, EVAS_TEXT_STYLE_SHADOW_DIRECTION_RIGHT },
15289};
15290
15291static void
15292_efl_canvas_text_efl_text_style_effect_type_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Effect_Type type EINA_UNUSED)
15293{
15294 _FMT_INFO_SET_START(effect, type);
15295 _FMT(style) = _map_style_effect[type].y;
15296 // Re-apply shadow direction
15297 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y);
15298 _FMT_INFO_SET_END();
15299}
15300
15301static Efl_Text_Style_Effect_Type
15302_efl_canvas_text_efl_text_style_effect_type_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15303{
15304 return _FMT_INFO(effect);
15305}
15306
15307static void
15308_efl_canvas_text_efl_text_style_outline_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15309{
15310 _FMT_COLOR_SET(outline);
15311}
15312
15313static void
15314_efl_canvas_text_efl_text_style_outline_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15315{
15316 _FMT_COLOR_RET(outline);
15317}
15318
15319static void
15320_efl_canvas_text_efl_text_style_shadow_direction_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Style_Shadow_Direction type EINA_UNUSED)
15321{
15322 _FMT_INFO_SET_START(shadow_direction, type);
15323 EVAS_TEXT_STYLE_SHADOW_DIRECTION_SET(_FMT(style), _map_shadow_dir[type].y);
15324 _FMT_INFO_SET_END();
15325}
15326
15327static Efl_Text_Style_Shadow_Direction
15328_efl_canvas_text_efl_text_style_shadow_direction_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15329{
15330 return _FMT_INFO(shadow_direction);
15331}
15332
15333static void
15334_efl_canvas_text_efl_text_style_shadow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15335{
15336 _FMT_COLOR_SET(shadow);
15337}
15338
15339static void
15340_efl_canvas_text_efl_text_style_shadow_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15341{
15342 _FMT_COLOR_RET(shadow);
15343}
15344
15345static void
15346_efl_canvas_text_efl_text_style_glow_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15347{
15348 _FMT_COLOR_SET(glow);
15349}
15350
15351static void
15352_efl_canvas_text_efl_text_style_glow_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15353{
15354 _FMT_COLOR_RET(glow);
15355}
15356
15357static void
15358_efl_canvas_text_efl_text_style_glow2_color_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char r EINA_UNUSED, unsigned char g EINA_UNUSED, unsigned char b EINA_UNUSED, unsigned char a EINA_UNUSED)
15359{
15360 _FMT_COLOR_SET(glow2);
15361}
15362
15363static void
15364_efl_canvas_text_efl_text_style_glow2_color_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, unsigned char *r EINA_UNUSED, unsigned char *g EINA_UNUSED, unsigned char *b EINA_UNUSED, unsigned char *a EINA_UNUSED)
15365{
15366 _FMT_COLOR_RET(glow2);
15367}
15368
15369static void
15370_efl_canvas_text_efl_text_format_format_ellipsis_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
15371{
15372 _FMT_SET(ellipsis, value);
15373}
15374
15375static double
15376_efl_canvas_text_efl_text_format_format_ellipsis_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15377{
15378 return _FMT(ellipsis);
15379}
15380
15381static void
15382_efl_canvas_text_efl_text_format_format_wrap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Efl_Text_Format_Wrap wrap EINA_UNUSED)
15383{
15384 _FMT_INFO_SET_START(wrap, wrap);
15385 _FMT(wrap_word) = (wrap == EFL_TEXT_FORMAT_WRAP_WORD);
15386 _FMT(wrap_char) = (wrap == EFL_TEXT_FORMAT_WRAP_CHAR);
15387 _FMT(wrap_mixed) = (wrap == EFL_TEXT_FORMAT_WRAP_MIXED);
15388 _FMT(wrap_hyphenation) = (wrap == EFL_TEXT_FORMAT_WRAP_HYPHENATION);
15389 _FMT_INFO_SET_END();
15390}
15391
15392static Efl_Text_Format_Wrap
15393_efl_canvas_text_efl_text_format_format_wrap_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15394{
15395 return _FMT_INFO(wrap);
15396}
15397
15398static void
15399_efl_canvas_text_efl_text_format_format_multiline_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Eina_Bool enabled EINA_UNUSED)
15400{
15401 if (o->multiline == enabled) return;
15402 o->multiline = enabled;
15403 _canvas_text_format_changed(obj, o);
15404}
15405
15406static Eina_Bool
15407_efl_canvas_text_efl_text_format_format_multiline_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15408{
15409 return o->multiline;
15410}
15411
15412static void
15413_efl_canvas_text_efl_text_format_format_halign_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
15414{
15415 if (value < 0.0)
15416 {
15417 _FMT_SET(halign_auto, EINA_TRUE);
15418 }
15419 else
15420 {
15421 _FMT(halign_auto) = EINA_FALSE;
15422 _FMT_SET(halign, value);
15423 }
15424}
15425
15426static double
15427_efl_canvas_text_efl_text_format_format_halign_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15428{
15429 return (_FMT(halign_auto) ? -1.0 : _FMT(halign));
15430}
15431
15432static void
15433_efl_canvas_text_efl_text_format_format_valign_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
15434{
15435 _FMT_SET(valign, value);
15436}
15437
15438static double
15439_efl_canvas_text_efl_text_format_format_valign_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15440{
15441 return _FMT(valign);
15442}
15443
15444static void
15445_efl_canvas_text_efl_text_format_format_linegap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
15446{
15447 double linerelgap = _FMT(linerelgap);
15448 _FMT(linerelgap) = 0.0;
15449
15450 if (EINA_DBL_EQ(linerelgap, 0.0))
15451 {
15452 _FMT_SET(linegap, value);
15453 }
15454 else
15455 {
15456 _FMT(linegap) = value;
15457 _FMT(linerelgap) = 0.0;
15458 _canvas_text_format_changed(obj, o);
15459 }
15460}
15461
15462static double
15463_efl_canvas_text_efl_text_format_format_linegap_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15464{
15465 return _FMT(linegap);
15466}
15467
15468static void
15469_efl_canvas_text_efl_text_format_format_linerelgap_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, double value EINA_UNUSED)
15470{
15471 double linegap = _FMT(linegap);
15472 _FMT(linegap) = 0.0;
15473
15474 if (EINA_DBL_EQ(linegap, 0.0))
15475 {
15476 _FMT_SET(linerelgap, value);
15477 }
15478 else
15479 {
15480 _FMT(linerelgap) = value;
15481 _canvas_text_format_changed(obj, o);
15482 }
15483}
15484
15485static double
15486_efl_canvas_text_efl_text_format_format_linerelgap_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15487{
15488 return _FMT(linerelgap);
15489}
15490
15491static void
15492_efl_canvas_text_efl_text_format_format_tabstops_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, int value EINA_UNUSED)
15493{
15494 _FMT_SET(tabstops, value);
15495}
15496
15497static int
15498_efl_canvas_text_efl_text_format_format_tabstops_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15499{
15500 return _FMT(tabstops);
15501}
15502
15503static void
15504_efl_canvas_text_efl_text_format_format_password_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, Eina_Bool enabled EINA_UNUSED)
15505{
15506 _FMT_SET(password, enabled);
15507}
15508
15509static Eina_Bool
15510_efl_canvas_text_efl_text_format_format_password_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15511{
15512 return _FMT(password);
15513}
15514
15515static void
15516_efl_canvas_text_efl_text_format_format_replacement_char_set(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED, const char *repch EINA_UNUSED)
15517{
15518 Eina_Stringshare *nrepch;
15519 if (o->repch != repch)
15520 {
15521 nrepch = eina_stringshare_add(repch);
15522 if (nrepch == _FMT_INFO(font_fallbacks))
15523 {
15524 /* Already stringshared here, unref */
15525 eina_stringshare_del(nrepch);
15526 }
15527 else
15528 {
15529 // Set immediately, load repch later
15530 o->repch = nrepch;
15531 _canvas_text_format_changed(obj, o);
15532 }
15533 }
15534}
15535
15536static const char *
15537_efl_canvas_text_efl_text_format_format_replacement_char_get(Eo *obj EINA_UNUSED, Efl_Canvas_Text_Data *o EINA_UNUSED)
15538{
15539 return o->repch;
15540}
15541
14831/** 15542/**
14832 * @} 15543 * @}
14833 */ 15544 */