diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -86,6 +86,7 @@ textblock_intl.c \ textblock_auto_align.c \ textblock_text_append.c \ +textblock_text_fill_format.c \ rect_blend.c \ rect_blend_pow2.c \ rect_solid.c \ diff --git a/src/bin/meson.build b/src/bin/meson.build --- a/src/bin/meson.build +++ b/src/bin/meson.build @@ -76,6 +76,7 @@ 'textblock_intl.c', 'textblock_auto_align.c', 'textblock_text_append.c', + 'textblock_text_fill_format.c', 'rect_blend.c', 'rect_blend_pow2.c', 'rect_solid.c', diff --git a/src/bin/tests.h b/src/bin/tests.h --- a/src/bin/tests.h +++ b/src/bin/tests.h @@ -69,6 +69,7 @@ #include "textblock_intl.c" #include "textblock_auto_align.c" #include "textblock_text_append.c" +#include "textblock_text_fill_format.c" #include "rect_blend.c" #include "rect_blend_pow2.c" #include "rect_solid.c" diff --git a/src/bin/textblock_text_fill_format.c b/src/bin/textblock_text_fill_format.c new file mode 100644 --- /dev/null +++ b/src/bin/textblock_text_fill_format.c @@ -0,0 +1,103 @@ +#undef FNAME +#undef NAME +#undef ICON + +/* metadata */ +#define FNAME textblock_text_fill_format +#define NAME "Textblock text_fill_format" +#define ICON "text.png" + +#ifndef PROTO +# ifndef UI +# include "main.h" + +/* standard var */ +static int done = 0; + +/* private data */ +static Evas_Object *o_text; +static int sizes[] = {500, 600}; +Evas_Coord ll, rr, tt, bb; + +/* setup */ +static void _setup(void) +{ + Evas_Object *o; + Evas_Textblock_Style *st; + + o = evas_object_textblock_add(evas); + o_text = o; + st = evas_textblock_style_new(); + evas_textblock_style_set (st, "DEFAULT='font=Sans font_size=10 color=#000000 wrap=word align=left outline_color=#000 shadow_color=#fff8 shadow_color=#0002 glow2_color=#fe87 glow_color=#f214 underline_color=#00f linesize=40'"); + evas_object_textblock_style_set(o, st); + evas_object_textblock_clear(o); + evas_object_textblock_text_markup_set(o, "This test resize text block and keep style (style parsed only once)"); + + efl_gfx_entity_position_set(o, EINA_POSITION2D(0, 0)); \ + efl_gfx_entity_size_set(o, EINA_SIZE2D(win_w, win_h)); \ + efl_gfx_entity_visible_set(o, EINA_TRUE); + + evas_textblock_style_free(st); + + done = 0; +} + +/* cleanup */ +static void _cleanup(void) +{ + efl_del(o_text); + o_text = NULL; +} + +/* loop - do things */ +static void _loop(double t, int f) +{ + for (int i = 0; i < 10000; i++) + { + evas_object_resize(o_text,sizes[i%2],sizes[i%2]); + evas_object_textblock_style_insets_get((Efl_Canvas_Object*) o_text, &ll, &rr, &tt, &bb); + } + FPS_STD(NAME); +} + +/* prepend special key handlers if interactive (before STD) */ +static void _key(const char *key) +{ + KEY_STD; +} + + + + + + + + + + + + +/* template stuff - ignore */ +# endif +#endif + +#ifdef UI +_ui_menu_item_add(ICON, NAME, FNAME); +#endif + +#ifdef PROTO +void FNAME(void); +#endif + +#ifndef PROTO +# ifndef UI +void FNAME(void) +{ + ui_func_set(_key, _loop); + _setup(); +} +# endif +#endif +#undef FNAME +#undef NAME +#undef ICON