aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/language/evas_bidi_utils.h
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/language/evas_bidi_utils.h
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/language/evas_bidi_utils.h')
-rw-r--r--libraries/evas/src/lib/engines/common/language/evas_bidi_utils.h157
1 files changed, 157 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/language/evas_bidi_utils.h b/libraries/evas/src/lib/engines/common/language/evas_bidi_utils.h
new file mode 100644
index 0000000..f1a374b
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/language/evas_bidi_utils.h
@@ -0,0 +1,157 @@
1#ifndef _EVAS_BIDI_UTILS
2#define _EVAS_BIDI_UTILS
3
4/**
5 * @internal
6 * @addtogroup Evas_Utils
7 *
8 * @{
9 */
10/**
11 * @internal
12 * @defgroup Evas_BiDi Evas BiDi utility functions
13 *
14 * This set of functions and types helps evas handle BiDi strings correctly.
15 * @todo Document types, structures and macros.
16 *
17 * @{
18 */
19#ifdef HAVE_CONFIG_H
20# include "config.h"
21#endif
22
23#ifdef HAVE_FRIBIDI
24# define USE_FRIBIDI
25# define BIDI_SUPPORT
26#endif
27
28#include <Eina.h>
29
30#ifdef USE_FRIBIDI
31# include <fribidi/fribidi.h>
32#endif
33
34/* abstract fribidi - we statically define sizes here because otherwise we would
35 * have to ifdef everywhere (because function decorations may change with/without
36 * bidi support)
37 * These types should only be passed as pointers! i.e do not directely use any of
38 * these types in function declarations. Defining as void should help ensuring that.
39 */
40
41/* Evas_BiDi_Direction is defined in evas.h */
42
43#ifdef USE_FRIBIDI
44# define _EVAS_BIDI_TYPEDEF(type) \
45 typedef FriBidi ## type EvasBiDi ## type
46#else
47# define _EVAS_BIDI_TYPEDEF(type) \
48 typedef void EvasBiDi ## type
49#endif
50
51#if 0 /* We are using Eina_Unicode instead */
52_EVAS_BIDI_TYPEDEF(Char);
53#endif
54_EVAS_BIDI_TYPEDEF(CharType);
55_EVAS_BIDI_TYPEDEF(ParType);
56_EVAS_BIDI_TYPEDEF(StrIndex);
57_EVAS_BIDI_TYPEDEF(Level);
58_EVAS_BIDI_TYPEDEF(JoiningType);
59
60typedef struct _Evas_BiDi_Paragraph_Props Evas_BiDi_Paragraph_Props;
61typedef struct _Evas_BiDi_Props Evas_BiDi_Props;
62
63/* This structure defines a set of properties of a BiDi string. In case of a
64 * non-bidi string, all values should be NULL.
65 * To check if a structure describes a bidi string or not, use the macro
66 * EVAS_BIDI_IS_BIDI_PROP. RTL-only strings are also treated as bidi ATM.
67 */
68struct _Evas_BiDi_Paragraph_Props {
69 EvasBiDiCharType *char_types; /* BiDi char types */
70 EvasBiDiLevel *embedding_levels; /* BiDi embedding levels */
71 int refcount; /* The number of references to this object */
72#ifdef USE_FRIBIDI
73 EvasBiDiParType direction;
74#endif
75};
76
77#include "Evas.h"
78struct _Evas_BiDi_Props
79{
80 Evas_BiDi_Direction dir;
81};
82
83
84
85#ifdef USE_FRIBIDI
86
87#define EVAS_BIDI_PARAGRAPH_NEUTRAL FRIBIDI_PAR_ON
88#define EVAS_BIDI_PARAGRAPH_LTR FRIBIDI_PAR_LTR
89#define EVAS_BIDI_PARAGRAPH_RTL FRIBIDI_PAR_RTL
90#define EVAS_BIDI_PARAGRAPH_WLTR FRIBIDI_PAR_WLTR
91#define EVAS_BIDI_PARAGRAPH_WRTL FRIBIDI_PAR_WRTL
92
93#define EVAS_BIDI_PARAGRAPH_DIRECTION_IS_RTL(x) \
94 (((x) && \
95 ((x->direction == EVAS_BIDI_PARAGRAPH_RTL) || \
96 (x->direction == EVAS_BIDI_PARAGRAPH_WRTL))) ? \
97 EINA_TRUE : EINA_FALSE)
98
99
100# define evas_bidi_position_visual_to_logical(list, position) \
101 (list) ? list[position] : position;
102
103EvasBiDiStrIndex
104evas_bidi_position_logical_to_visual(EvasBiDiStrIndex *v_to_l, int len, EvasBiDiStrIndex position);
105
106EvasBiDiStrIndex
107evas_bidi_position_reverse(const Evas_BiDi_Props *props, int len, EvasBiDiStrIndex position);
108
109Eina_Bool
110evas_bidi_is_rtl_str(const Eina_Unicode *str);
111
112Eina_Bool
113evas_bidi_is_rtl_char(const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, EvasBiDiStrIndex index);
114
115int
116evas_bidi_end_of_run_get(const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, int len);
117
118Eina_Bool
119evas_bidi_props_reorder_line(Eina_Unicode *eina_ustr, size_t start, size_t len, const Evas_BiDi_Paragraph_Props *props, EvasBiDiStrIndex **_v_to_l);
120
121Evas_BiDi_Paragraph_Props *
122evas_bidi_paragraph_props_get(const Eina_Unicode *eina_ustr, size_t len, int *segment_idxs) EINA_ARG_NONNULL(1) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
123
124void
125evas_bidi_props_copy_and_ref(const Evas_BiDi_Props *src, Evas_BiDi_Props *dst);
126
127EAPI Eina_Bool
128evas_bidi_shape_string(Eina_Unicode *eina_ustr, const Evas_BiDi_Paragraph_Props *bidi_props, size_t start, size_t len);
129
130void
131evas_bidi_props_clean(Evas_BiDi_Props *intl_props) EINA_ARG_NONNULL(1);
132
133void
134evas_bidi_paragraph_props_clean(Evas_BiDi_Paragraph_Props *bidi_props) EINA_ARG_NONNULL(1);
135
136Evas_BiDi_Paragraph_Props *
137evas_bidi_paragraph_props_ref(Evas_BiDi_Paragraph_Props *bidi_props) EINA_ARG_NONNULL(1);
138
139void
140evas_bidi_paragraph_props_unref(Evas_BiDi_Paragraph_Props *bidi_props) EINA_ARG_NONNULL(1);
141
142Evas_BiDi_Paragraph_Props *
143evas_bidi_paragraph_props_new(void) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
144
145int *
146evas_bidi_segment_idxs_get(const Eina_Unicode *str, const char *delim) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT EINA_MALLOC;
147
148#endif
149/**
150 * @}
151 */
152/**
153 * @}
154 */
155
156#endif
157