aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_font_default_walk.x
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/engines/common/evas_font_default_walk.x
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_font_default_walk.x')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_font_default_walk.x144
1 files changed, 144 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_font_default_walk.x b/libraries/evas/src/lib/engines/common/evas_font_default_walk.x
new file mode 100644
index 0000000..94e7fde
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_font_default_walk.x
@@ -0,0 +1,144 @@
1#ifndef _EVAS_FONT_DEFAULT_WALK_X
2#define _EVAS_FONT_DEFAULT_WALK_X
3/* Macros for text walking */
4
5/**
6 * @def EVAS_FONT_WALK_TEXT_INIT
7 * @internal
8 * This macro defines the variables that will later be used with the following
9 * macros, and by font handling functions.
10 * @see EVAS_FONT_WALK_TEXT_START
11 * @see EVAS_FONT_WALK_TEXT_WORK
12 * @see EVAS_FONT_WALK_TEXT_END
13 */
14# define EVAS_FONT_WALK_TEXT_INIT() \
15 int _pen_x = 0, _pen_y = 0; \
16 Evas_Coord _start_pen = (text_props->info && \
17 (text_props->start > 0)) ? \
18 text_props->info->glyph[text_props->start - 1].pen_after : 0 ; \
19 size_t char_index; \
20 (void) _pen_y; /* Sometimes it won't be used */
21
22/* Visual walk helper macros */
23#ifdef OT_SUPPORT
24#define _EVAS_FONT_WALK_TEXT_START() \
25 Evas_Font_OT_Info *_ot_itr = (text_props->info) ? \
26 text_props->info->ot + text_props->start : NULL; \
27 if (!_ot_itr) break; \
28 for (char_index = 0 ; char_index < text_props->len ; char_index++, _glyph_itr++, _ot_itr++) \
29 {
30#else
31#define _EVAS_FONT_WALK_TEXT_START() \
32 for (char_index = 0 ; char_index < text_props->len ; char_index++, _glyph_itr++) \
33 {
34#endif
35
36/**
37 * @def EVAS_FONT_WALK_TEXT_START
38 * @internal
39 * This runs through the text in visual order while updating char_index,
40 * which is the current index in the text.
41 * Does not end with a ;
42 * Take a look at EVAS_FONT_WALK_X_OFF and the like.
43 * @see EVAS_FONT_WALK_TEXT_INIT
44 * @see EVAS_FONT_WALK_TEXT_WORK
45 * @see EVAS_FONT_WALK_TEXT_END
46 */
47#define EVAS_FONT_WALK_TEXT_START() \
48 do \
49 { \
50 Evas_Font_Glyph_Info *_glyph_itr = (text_props->info) ? \
51 text_props->info->glyph + text_props->start : NULL; \
52 if (!_glyph_itr) break; \
53 _EVAS_FONT_WALK_TEXT_START()
54
55/*FIXME: doc */
56#ifdef OT_SUPPORT
57# define EVAS_FONT_WALK_X_OFF \
58 (EVAS_FONT_ROUND_26_6_TO_INT(EVAS_FONT_OT_X_OFF_GET(*_ot_itr)))
59# define EVAS_FONT_WALK_Y_OFF \
60 (EVAS_FONT_ROUND_26_6_TO_INT(EVAS_FONT_OT_Y_OFF_GET(*_ot_itr)))
61# define EVAS_FONT_WALK_POS \
62 (EVAS_FONT_OT_POS_GET(*_ot_itr) - text_props->text_offset)
63# define EVAS_FONT_WALK_POS_NEXT \
64 ((!EVAS_FONT_WALK_IS_LAST) ? \
65 EVAS_FONT_OT_POS_GET(*(_ot_itr + 1)) - \
66 text_props->text_offset : \
67 EVAS_FONT_WALK_POS \
68 )
69# define EVAS_FONT_WALK_POS_PREV \
70 ((char_index > 0) ? \
71 EVAS_FONT_OT_POS_GET(*(_ot_itr - 1)) - \
72 text_props->text_offset : \
73 EVAS_FONT_WALK_POS \
74 )
75#else
76# define EVAS_FONT_WALK_X_OFF 0
77# define EVAS_FONT_WALK_Y_OFF 0
78# define EVAS_FONT_WALK_POS \
79 ((text_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) ? \
80 (text_props->len - char_index - 1) : \
81 (char_index))
82# define EVAS_FONT_WALK_POS_NEXT \
83 ((!EVAS_FONT_WALK_IS_LAST) ? \
84 ((text_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) ? \
85 text_props->len - char_index - 2 \
86 : (char_index + 1)) : \
87 EVAS_FONT_WALK_POS)
88# define EVAS_FONT_WALK_POS_PREV \
89 ((char_index > 0) ? \
90 ((text_props->bidi.dir == EVAS_BIDI_DIRECTION_RTL) ? \
91 text_props->len - char_index \
92 : (char_index - 1)) : \
93 EVAS_FONT_WALK_POS)
94#endif
95
96
97#define EVAS_FONT_WALK_IS_VISIBLE (_glyph_itr->index != 0)
98#define EVAS_FONT_WALK_X_BEAR (_glyph_itr->x_bear)
99#define EVAS_FONT_WALK_Y_BEAR (fg->glyph_out->top)
100#define EVAS_FONT_WALK_X_ADV ((_glyph_itr > text_props->info->glyph) ? \
101 _glyph_itr->pen_after - (_glyph_itr - 1)->pen_after : \
102 _glyph_itr->pen_after)
103#define EVAS_FONT_WALK_WIDTH (_glyph_itr->width)
104
105#define EVAS_FONT_WALK_INDEX (_glyph_itr->index)
106#define EVAS_FONT_WALK_PEN_X (_pen_x)
107#define EVAS_FONT_WALK_PEN_X_AFTER (_glyph_itr->pen_after - _start_pen)
108#define EVAS_FONT_WALK_PEN_Y (EVAS_FONT_ROUND_26_6_TO_INT(_pen_y))
109#define EVAS_FONT_WALK_Y_ADV (0)
110#define EVAS_FONT_WALK_IS_LAST \
111 (char_index + 1 == text_props->len)
112#define EVAS_FONT_WALK_IS_FIRST \
113 (char_index == 0)
114#define EVAS_FONT_WALK_LEN (text_props->len)
115
116/**
117 * @def EVAS_FONT_WALK_TEXT_WORK
118 * @internal
119 * This macro actually updates the values mentioned in EVAS_FONT_WALK_TEXT_START
120 * according to the current positing in the walk.
121 * @see EVAS_FONT_WALK_TEXT_START
122 * @see EVAS_FONT_WALK_TEXT_INIT
123 * @see EVAS_FONT_WALK_TEXT_END
124 */
125#define EVAS_FONT_WALK_TEXT_WORK() do {} while(0)
126
127/**
128 * @def EVAS_FONT_WALK_TEXT_END
129 * @internal
130 * Closes EVAS_FONT_WALK_TEXT_START, needs to end with a ;
131 * @see EVAS_FONT_WALK_TEXT_START
132 * @see EVAS_FONT_WALK_TEXT_INIT
133 * @see EVAS_FONT_WALK_TEXT_WORK
134 */
135#define EVAS_FONT_WALK_TEXT_END() \
136 if (EVAS_FONT_WALK_IS_VISIBLE) \
137 { \
138 _pen_x = _glyph_itr->pen_after - _start_pen; \
139 } \
140 } \
141 } \
142 while(0)
143
144#endif