In this example, we illustrate how to use text objects in various manners.

We place, in the canvas, a text object along with a border image to delimit its geometry. After we instantiate the text object, we set lots of properties on it to the initial ones from a preset list, which has the following declaration\+:  
\begin{DoxyCodeInclude}
   \textcolor{comment}{/* init values one is going to cycle through while running this}
\textcolor{comment}{    * example */}
   \textcolor{keyword}{struct }text\_preset\_data init\_data =
   \{
      .font = \{\textcolor{stringliteral}{"DejaVu"}, \textcolor{stringliteral}{"Courier"}, \textcolor{stringliteral}{"Utopia"}\},
      .text = \{BLACK, WHITE, GREY, RED, GREEN, BLUE\},
      .shadow = \{WHITE, BLUE, GREEN, RED\},
      .outline = \{WHITE, RED, GREEN, BLUE\},
      .glow = \{WHITE, BLUE, GREEN, RED\},
      .glow2 = \{WHITE, RED, BLUE, GREEN\}
   \};

\end{DoxyCodeInclude}


Then, we set the text string itself, on it, with \hyperlink{group__Evas__Object__Text_gabe57fc428ee4db9e9d7feb9e3a108fb3}{evas\+\_\+object\+\_\+text\+\_\+text\+\_\+set()}. We set an explicit size of 30 points for our font, as you could see, what we check back with the getter \hyperlink{group__Evas__Object__Text_ga2a13b7617af385b847d133da15357c13}{evas\+\_\+object\+\_\+text\+\_\+font\+\_\+get()}.

Look at how it translates to code\+:  
\begin{DoxyCodeInclude}
   d.text = \hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}(d.evas);
   evas\_object\_text\_style\_set(d.text, EVAS\_TEXT\_STYLE\_PLAIN);

   \textcolor{comment}{/* let the pre-set thingies be enforced */}
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
     d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
     d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

   evas\_object\_text\_glow\_color\_set(
     d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
     d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

   evas\_object\_text\_glow2\_color\_set(
     d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
     d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

   evas\_object\_text\_outline\_color\_set(
     d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
     d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

   evas\_object\_text\_shadow\_color\_set(
     d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
     d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

   \hyperlink{group__Evas__Object__Text_ga1813cea2c010c923d31787caec5dc857}{evas\_object\_text\_font\_set}(d.text, *d.t\_data.font\_ptr, 30);
   \hyperlink{group__Evas__Object__Text_gabe57fc428ee4db9e9d7feb9e3a108fb3}{evas\_object\_text\_text\_set}(d.text, \textcolor{stringliteral}{"sample text"});

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.text, (3 * WIDTH) / 4, HEIGHT / 4);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.text, WIDTH / 8, (3 * HEIGHT) / 8);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.text);

   \hyperlink{group__Evas__Object__Text_ga2a13b7617af385b847d133da15357c13}{evas\_object\_text\_font\_get}(d.text, &font, &size);
   fprintf(stdout, \textcolor{stringliteral}{"Adding text object with font %s, size %d\(\backslash\)n"}, font, size);

\end{DoxyCodeInclude}


Like in other Evas examples, one interacts with it by means of key commands\+:  
\begin{DoxyCodeInclude}
\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - change text's current style\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tz - change text's font size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tf - change text's font family\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - change text's base color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - change text's \(\backslash\)'shadow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)to - change text's \(\backslash\)'outline\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - change text's \(\backslash\)'glow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tg - change text's \(\backslash\)'glow 2\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\end{DoxyCodeInclude}


Use the \textquotesingle{}t\textquotesingle{} key to exercise the evas\+\_\+object\+\_\+text\+\_\+style\+\_\+set() function on the text -- it will cycle through all styles on \hyperlink{group__Evas_ga6b48c195b58fbe30ca8180e7451ad817}{Evas\+\_\+\+Text\+\_\+\+Style\+\_\+\+Type} (note we start on \#\+E\+V\+A\+S\+\_\+\+T\+E\+X\+T\+\_\+\+S\+T\+Y\+L\+E\+\_\+\+P\+L\+A\+I\+N, thus with no effects on it) and, with other keys, you\textquotesingle{}ll be able to set properties applicable to individual styles on the text object.

The \textquotesingle{}z\textquotesingle{} key will change the text\textquotesingle{}s {\bfseries size}, keeping the font family for it. Use \textquotesingle{}f\textquotesingle{} to change the font, keeping the last size set. There are three font families the example will cycle through\+:

The \textquotesingle{}b\textquotesingle{} command shows us that \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\+\_\+object\+\_\+color\+\_\+set()}, on a given text object, will change the text\textquotesingle{}s {\bfseries base} color. Experiment with it, which will cycle through the colors in the {\ttfamily .text} list in {\ttfamily init\+\_\+data}.

The \textquotesingle{}s\textquotesingle{}, \textquotesingle{}o\textquotesingle{}, \textquotesingle{}w\textquotesingle{} and \textquotesingle{}g\textquotesingle{} keys will make the text object to cycle to the preset values on colors for shadow, outline, glow and \textquotesingle{}glow 2\textquotesingle{} effects, respectively. Naturally, they will only take effect on the text styles which resemble them.

The full example follows.


\begin{DoxyCodeInclude}

\textcolor{preprocessor}{#ifdef HAVE\_CONFIG\_H}
\textcolor{preprocessor}{#include "config.h"}
\textcolor{preprocessor}{#else}
\textcolor{preprocessor}{#define PACKAGE\_EXAMPLES\_DIR "."}
\textcolor{preprocessor}{#endif}

\textcolor{preprocessor}{#include <Ecore.h>}
\textcolor{preprocessor}{#include <\hyperlink{Ecore__Evas_8h}{Ecore\_Evas.h}>}
\textcolor{preprocessor}{#include <stdio.h>}
\textcolor{preprocessor}{#include <errno.h>}

\textcolor{preprocessor}{#define WIDTH  (320)}
\textcolor{preprocessor}{#define HEIGHT (240)}

\textcolor{preprocessor}{#define GREY \{190, 190, 190, 255\}}
\textcolor{preprocessor}{#define BLACK \{0, 0, 0, 255\}}
\textcolor{preprocessor}{#define WHITE \{255, 255, 255, 255\}}
\textcolor{preprocessor}{#define RED   \{255, 0, 0, 255\}}
\textcolor{preprocessor}{#define GREEN \{0, 255, 0, 255\}}
\textcolor{preprocessor}{#define BLUE  \{0, 0, 255, 255\}}

\textcolor{preprocessor}{#define POINTER\_CYCLE(\_ptr, \_array)                             \(\backslash\)}
\textcolor{preprocessor}{  do                                                            \(\backslash\)}
\textcolor{preprocessor}{    \{                                                           \(\backslash\)}
\textcolor{preprocessor}{       if ((unsigned int)(((unsigned char *)(\_ptr)) - ((unsigned char *)(\_array))) >= \(\backslash\)}
\textcolor{preprocessor}{           sizeof(\_array))                                      \(\backslash\)}
\textcolor{preprocessor}{         \_ptr = \_array;                                         \(\backslash\)}
\textcolor{preprocessor}{    \}                                                           \(\backslash\)}
\textcolor{preprocessor}{  while(0)}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *commands = \(\backslash\)
  \textcolor{stringliteral}{"commands are:\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tt - change text's current style\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tz - change text's font size\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tf - change text's font family\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tb - change text's base color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)ts - change text's \(\backslash\)'shadow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)to - change text's \(\backslash\)'outline\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tw - change text's \(\backslash\)'glow\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)tg - change text's \(\backslash\)'glow 2\(\backslash\)' color\(\backslash\)n"}
  \textcolor{stringliteral}{"\(\backslash\)th - print help\(\backslash\)n"};

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *border\_img\_path = PACKAGE\_EXAMPLES\_DIR \textcolor{stringliteral}{"/red.png"};

\textcolor{keyword}{struct }color\_tuple
\{
   \textcolor{keywordtype}{int} r, g, b, a;
\};

\textcolor{keyword}{struct }text\_preset\_data
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}        **font\_ptr;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char}         *font[3];

   \textcolor{keyword}{struct }color\_tuple *text\_ptr;
   \textcolor{keyword}{struct }color\_tuple  text[6];

   \textcolor{keyword}{struct }color\_tuple *shadow\_ptr;
   \textcolor{keyword}{struct }color\_tuple  shadow[4];

   \textcolor{keyword}{struct }color\_tuple *outline\_ptr;
   \textcolor{keyword}{struct }color\_tuple  outline[4];

   \textcolor{keyword}{struct }color\_tuple *glow\_ptr;
   \textcolor{keyword}{struct }color\_tuple  glow[4];

   \textcolor{keyword}{struct }color\_tuple *glow2\_ptr;
   \textcolor{keyword}{struct }color\_tuple  glow2[4];
\};

\textcolor{keyword}{struct }test\_data
\{
   Ecore\_Evas             *ee;
   \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}                   *evas;
   \textcolor{keyword}{struct }text\_preset\_data t\_data;
   \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}            *text, *bg, *border;
\};

\textcolor{keyword}{static} \textcolor{keyword}{struct }test\_data d = \{0\};

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_destroy(Ecore\_Evas *ee EINA\_UNUSED)
\{
   \hyperlink{group__Ecore__Main__Loop__Group_ga95cf8e97dff0716433c2c5474d606a98}{ecore\_main\_loop\_quit}();
\}

\textcolor{comment}{/* here just to keep our example's window size and background image's}
\textcolor{comment}{ * size in synchrony */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_canvas\_resize\_cb(Ecore\_Evas *ee)
\{
   \textcolor{keywordtype}{int} w, h;

   \hyperlink{group__Ecore__Evas__Group_ga931aadf4603731e73e8a84e4b14f1493}{ecore\_evas\_geometry\_get}(ee, NULL, NULL, &w, &h);
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.bg, w, h);
\}

\textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *
\_text\_style\_type\_to\_str(\hyperlink{group__Evas_ga6b48c195b58fbe30ca8180e7451ad817}{Evas\_Text\_Style\_Type} mode)
\{
   \textcolor{keywordflow}{switch} (mode)
     \{
      \textcolor{keywordflow}{case} EVAS\_TEXT\_STYLE\_PLAIN:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"plain"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817ad8982ee65d30fbf666261fd1990c4a6f}{EVAS\_TEXT\_STYLE\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"shadow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a66399bfe91951039c91ebdee89639d86}{EVAS\_TEXT\_STYLE\_OUTLINE}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a370e3941067f77326acb76fb174e0d93}{EVAS\_TEXT\_STYLE\_SOFT\_OUTLINE}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"soft outline"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817ad42b9d71564c7983f28e9524bafff6d2}{EVAS\_TEXT\_STYLE\_GLOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"glow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a41d98859fcb308553d839efb2589bb90}{EVAS\_TEXT\_STYLE\_OUTLINE\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline shadow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a392c2d181f5d12df34c8d8c8d8977d8c}{EVAS\_TEXT\_STYLE\_FAR\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"far shadow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a7583f30324e938dbcf2d5089de09a5a0}{EVAS\_TEXT\_STYLE\_OUTLINE\_SOFT\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"outline soft shadow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a5675086aa98175b86803dc515972737f}{EVAS\_TEXT\_STYLE\_SOFT\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"soft shadow"};

      \textcolor{keywordflow}{case} \hyperlink{group__Evas_gga6b48c195b58fbe30ca8180e7451ad817a7ef1a030ee4fe4ee7782528e6ffb38b1}{EVAS\_TEXT\_STYLE\_FAR\_SOFT\_SHADOW}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"far soft shadow"};

      \textcolor{keywordflow}{default}:
        \textcolor{keywordflow}{return} \textcolor{stringliteral}{"invalid"};
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_on\_keydown(\textcolor{keywordtype}{void}        *data EINA\_UNUSED,
            \hyperlink{group__Evas__Canvas_ga5ff87cc4ce6bc43e3b640a6d37f73043}{Evas}        *evas EINA\_UNUSED,
            \hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object} *o EINA\_UNUSED,
            \textcolor{keywordtype}{void}        *einfo)
\{
   \hyperlink{struct__Evas__Event__Key__Down}{Evas\_Event\_Key\_Down} *ev = einfo;

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"h"}) == 0) \textcolor{comment}{/* print help */}
     \{
        fprintf(stdout, commands);
        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"t"}) == 0) \textcolor{comment}{/* change text's current style */}
     \{
        \hyperlink{group__Evas_ga6b48c195b58fbe30ca8180e7451ad817}{Evas\_Text\_Style\_Type} type = evas\_object\_text\_style\_get(d.text);

        type = (type + 1) % 10;

        evas\_object\_text\_style\_set(d.text, type);

        fprintf(stdout, \textcolor{stringliteral}{"Changing text's style to \(\backslash\)'%s\(\backslash\)'\(\backslash\)n"},
                \_text\_style\_type\_to\_str(type));

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"f"}) == 0) \textcolor{comment}{/* change text's font */}
     \{
         \textcolor{keywordtype}{int} sz;

        (d.t\_data.font\_ptr)++;

        \hyperlink{group__Evas__Object__Text_ga2a13b7617af385b847d133da15357c13}{evas\_object\_text\_font\_get}(d.text, NULL, &sz);

        POINTER\_CYCLE(d.t\_data.font\_ptr, d.t\_data.font);

        \hyperlink{group__Evas__Object__Text_ga1813cea2c010c923d31787caec5dc857}{evas\_object\_text\_font\_set}(d.text, *d.t\_data.font\_ptr, sz);

        fprintf(stdout, \textcolor{stringliteral}{"Changing text's font to %s\(\backslash\)n"}, *d.t\_data.font\_ptr);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"b"}) == 0) \textcolor{comment}{/* change text's base color */}
     \{
        (d.t\_data.text\_ptr)++;

        POINTER\_CYCLE(d.t\_data.text\_ptr, d.t\_data.text);

        \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
          d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
          d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

        fprintf(stdout, \textcolor{stringliteral}{"Changing base color for text to (%d, %d, %d, %d)\(\backslash\)n"},
                d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
                d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"g"}) == 0) \textcolor{comment}{/* change text's glow 2 color */}
     \{
        (d.t\_data.glow2\_ptr)++;

        POINTER\_CYCLE(d.t\_data.glow2\_ptr, d.t\_data.glow2);

        evas\_object\_text\_glow2\_color\_set(
          d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
          d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

        fprintf(stdout, \textcolor{stringliteral}{"Changing glow 2 color for text to (%d, %d, %d, %d)\(\backslash\)n"},
                d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
                d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"w"}) == 0) \textcolor{comment}{/* change text's glow color */}
     \{
        (d.t\_data.glow\_ptr)++;

        POINTER\_CYCLE(d.t\_data.glow\_ptr, d.t\_data.glow);

        evas\_object\_text\_glow\_color\_set(
          d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
          d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

        fprintf(stdout, \textcolor{stringliteral}{"Changing glow color for text to (%d, %d, %d, %d)\(\backslash\)n"},
                d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
                d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"o"}) == 0) \textcolor{comment}{/* change text's outline color */}
     \{
        (d.t\_data.outline\_ptr)++;

        POINTER\_CYCLE(d.t\_data.outline\_ptr, d.t\_data.outline);

        evas\_object\_text\_outline\_color\_set(
          d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
          d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

        fprintf(stdout, \textcolor{stringliteral}{"Changing outline color for text to (%d, %d, %d, %d)\(\backslash\)n"},
                d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
                d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"s"}) == 0) \textcolor{comment}{/* change text's shadow color */}
     \{
        (d.t\_data.shadow\_ptr)++;

        POINTER\_CYCLE(d.t\_data.shadow\_ptr, d.t\_data.shadow);

        evas\_object\_text\_shadow\_color\_set(
          d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
          d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

        fprintf(stdout, \textcolor{stringliteral}{"Changing shadow color for text to (%d, %d, %d, %d)\(\backslash\)n"},
                d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
                d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

        \textcolor{keywordflow}{return};
     \}

   \textcolor{keywordflow}{if} (strcmp(ev->\hyperlink{struct__Evas__Event__Key__Down_a70473bba88a1afaee180a54150513824}{key}, \textcolor{stringliteral}{"z"}) == 0) \textcolor{comment}{/* change text's font size */}
     \{
        \textcolor{keyword}{const} \textcolor{keywordtype}{char} *font;
        \textcolor{keywordtype}{int} size;

        \hyperlink{group__Evas__Object__Text_ga2a13b7617af385b847d133da15357c13}{evas\_object\_text\_font\_get}(d.text, &font, &size);

        size = (size + 10) % 50;
        \textcolor{keywordflow}{if} (!size) size = 10;

        \hyperlink{group__Evas__Object__Text_ga1813cea2c010c923d31787caec5dc857}{evas\_object\_text\_font\_set}(d.text, font, size);

        fprintf(stdout, \textcolor{stringliteral}{"Changing text's font size to %d\(\backslash\)n"}, size);

        \textcolor{keywordflow}{return};
     \}
\}

\textcolor{keywordtype}{int}
main(\textcolor{keywordtype}{void})
\{
   \textcolor{keywordtype}{int} size;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *font;

   \textcolor{keywordflow}{if} (!\hyperlink{group__Ecore__Evas__Group_ga32ddbb6457033ad435a177eb0c4fe235}{ecore\_evas\_init}())
     \textcolor{keywordflow}{return} EXIT\_FAILURE;

   \textcolor{comment}{/* init values one is going to cycle through while running this}
\textcolor{comment}{    * example */}
   \textcolor{keyword}{struct }text\_preset\_data init\_data =
   \{
      .font = \{\textcolor{stringliteral}{"DejaVu"}, \textcolor{stringliteral}{"Courier"}, \textcolor{stringliteral}{"Utopia"}\},
      .text = \{BLACK, WHITE, GREY, RED, GREEN, BLUE\},
      .shadow = \{WHITE, BLUE, GREEN, RED\},
      .outline = \{WHITE, RED, GREEN, BLUE\},
      .glow = \{WHITE, BLUE, GREEN, RED\},
      .glow2 = \{WHITE, RED, BLUE, GREEN\}
   \};

   d.t\_data = init\_data;
   d.t\_data.font\_ptr = d.t\_data.font;
   d.t\_data.text\_ptr = d.t\_data.text;
   d.t\_data.glow\_ptr = d.t\_data.glow;
   d.t\_data.glow2\_ptr = d.t\_data.glow2;
   d.t\_data.outline\_ptr = d.t\_data.outline;
   d.t\_data.shadow\_ptr = d.t\_data.shadow;

   \textcolor{comment}{/* this will give you a window with an Evas canvas under the first}
\textcolor{comment}{    * engine available */}
   d.ee = \hyperlink{group__Ecore__Evas__Group_gac7f2cdbcb79635c34317c1183dd04cb0}{ecore\_evas\_new}(NULL, 10, 10, WIDTH, HEIGHT, NULL);
   \textcolor{keywordflow}{if} (!d.ee)
     \textcolor{keywordflow}{goto} error;

   \hyperlink{group__Ecore__Evas__Group_ga3680b5c89157167318192157a5d24ec4}{ecore\_evas\_callback\_destroy\_set}(d.ee, \_on\_destroy);
   \hyperlink{group__Ecore__Evas__Group_gaac67f679c9027059a34519fbdea360df}{ecore\_evas\_callback\_resize\_set}(d.ee, \_canvas\_resize\_cb);
   \hyperlink{group__Ecore__Evas__Group_ga4953047ff97d4f1b0d75a7d513d4f317}{ecore\_evas\_show}(d.ee);

   \textcolor{comment}{/* the canvas pointer, de facto */}
   d.evas = \hyperlink{group__Ecore__Evas__Group_ga75a7cc694b6069e78df47dab0b0f2d20}{ecore\_evas\_get}(d.ee);

   d.bg = \hyperlink{group__Evas__Object__Rectangle_ga4d80fc32ad1cac28428cebd65d746751}{evas\_object\_rectangle\_add}(d.evas);
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(d.bg, 255, 255, 255, 255); \textcolor{comment}{/* white bg */}
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.bg, 0, 0); \textcolor{comment}{/* at canvas' origin */}
   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.bg, WIDTH, HEIGHT); \textcolor{comment}{/* covers full canvas */}
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.bg);

   evas\_object\_focus\_set(d.bg, \hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE});
   \hyperlink{group__Evas__Object__Group__Events_ga23be30ac5cdfb780f1ff82e9108ec26b}{evas\_object\_event\_callback\_add}(
     d.bg, \hyperlink{group__Evas_ggad64cde0da38a60e7cb7905b3ab216968a336b86bad4f145f84c155e4922335584}{EVAS\_CALLBACK\_KEY\_DOWN}, \_on\_keydown, NULL);

   d.text = \hyperlink{group__Evas__Object__Text_ga72224822cf1772ef16b1554f0a6205d5}{evas\_object\_text\_add}(d.evas);
   evas\_object\_text\_style\_set(d.text, EVAS\_TEXT\_STYLE\_PLAIN);

   \textcolor{comment}{/* let the pre-set thingies be enforced */}
   \hyperlink{group__Evas__Object__Group__Basic_gae34bdcfd7f5100151f6ea8ef4a392949}{evas\_object\_color\_set}(
     d.text, d.t\_data.text\_ptr->r, d.t\_data.text\_ptr->g,
     d.t\_data.text\_ptr->b, d.t\_data.text\_ptr->a);

   evas\_object\_text\_glow\_color\_set(
     d.text, d.t\_data.glow\_ptr->r, d.t\_data.glow\_ptr->g,
     d.t\_data.glow\_ptr->b, d.t\_data.glow\_ptr->a);

   evas\_object\_text\_glow2\_color\_set(
     d.text, d.t\_data.glow2\_ptr->r, d.t\_data.glow2\_ptr->g,
     d.t\_data.glow2\_ptr->b, d.t\_data.glow2\_ptr->a);

   evas\_object\_text\_outline\_color\_set(
     d.text, d.t\_data.outline\_ptr->r, d.t\_data.outline\_ptr->g,
     d.t\_data.outline\_ptr->b, d.t\_data.outline\_ptr->a);

   evas\_object\_text\_shadow\_color\_set(
     d.text, d.t\_data.shadow\_ptr->r, d.t\_data.shadow\_ptr->g,
     d.t\_data.shadow\_ptr->b, d.t\_data.shadow\_ptr->a);

   \hyperlink{group__Evas__Object__Text_ga1813cea2c010c923d31787caec5dc857}{evas\_object\_text\_font\_set}(d.text, *d.t\_data.font\_ptr, 30);
   \hyperlink{group__Evas__Object__Text_gabe57fc428ee4db9e9d7feb9e3a108fb3}{evas\_object\_text\_text\_set}(d.text, \textcolor{stringliteral}{"sample text"});

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.text, (3 * WIDTH) / 4, HEIGHT / 4);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.text, WIDTH / 8, (3 * HEIGHT) / 8);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.text);

   \hyperlink{group__Evas__Object__Text_ga2a13b7617af385b847d133da15357c13}{evas\_object\_text\_font\_get}(d.text, &font, &size);
   fprintf(stdout, \textcolor{stringliteral}{"Adding text object with font %s, size %d\(\backslash\)n"}, font, size);

   \textcolor{comment}{/* this is a border around the text object above, here just to}
\textcolor{comment}{    * emphasize its geometry */}
   d.border = \hyperlink{group__Evas__Object__Image_ga0e8cb83d31d02bf583c75925b7cd14d7}{evas\_object\_image\_filled\_add}(d.evas);
   \hyperlink{group__Evas__Object__Image_gac27fd0ceabe5f56607b7a86d71577df1}{evas\_object\_image\_file\_set}(d.border, border\_img\_path, NULL);
   evas\_object\_image\_border\_set(d.border, 3, 3, 3, 3);
   evas\_object\_image\_border\_center\_fill\_set(d.border, \hyperlink{Evas__Common_8h_a4a05f0fd82f51c6b330e349457cdc7e2a2ad856ac6aab5e2659c3a584a37aec70}{EVAS\_BORDER\_FILL\_NONE});

   \hyperlink{group__Evas__Font__Group_ga21e8604c0e4a93e469bff4bd069e82b5}{evas\_object\_resize}(d.border, ((3 * WIDTH) / 4) + 3, (HEIGHT / 4) + 3);
   \hyperlink{group__Evas__Font__Group_ga02da8091bbac768b8e86c7b74b2a94f9}{evas\_object\_move}(d.border, (WIDTH / 8) - 3, ((3 * HEIGHT) / 8) - 3);
   \hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}(d.border);

   fprintf(stdout, commands);
   \hyperlink{group__Ecore__Main__Loop__Group_gaf103b9f668bb3e4fed12e52c6180132d}{ecore\_main\_loop\_begin}();

   \hyperlink{group__Ecore__Evas__Group_gad3ec61f2aa03df4d3dbfd0d311e0c8dc}{ecore\_evas\_free}(d.ee);
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} 0;

error:
   fprintf(stderr, \textcolor{stringliteral}{"you got to have at least one evas engine built and linked"}
                   \textcolor{stringliteral}{" up to ecore-evas for this example to run properly.\(\backslash\)n"});
   \hyperlink{group__Ecore__Evas__Group_gab8fa311077f749190c9b622f672b2214}{ecore\_evas\_shutdown}();
   \textcolor{keywordflow}{return} -1;
\}

\end{DoxyCodeInclude}
 