2 * fribidi-joining-types.c - character joining types
5 * Behdad Esfahbod, 2001, 2002, 2004
7 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
8 * Copyright (C) 2001,2002 Behdad Esfahbod
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public License
21 * along with this library, in a file named COPYING; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA
25 * For licensing issues, contact <fribidi.license@gmail.com>.
30 #include <fribidi-joining-types.h>
32 #include "joining-types.h"
34 enum FriBidiJoiningTypeShortEnum
36 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE,
37 # include "fribidi-joining-types-list.h"
38 # undef _FRIBIDI_ADD_TYPE
42 #include "joining-type.tab.i"
44 FRIBIDI_ENTRY FriBidiJoiningType
45 fribidi_get_joining_type (
50 return FRIBIDI_GET_JOINING_TYPE (ch);
54 fribidi_get_joining_types (
56 const FriBidiChar *str,
57 const FriBidiStrIndex len,
59 FriBidiJoiningType *jtypes
62 register FriBidiStrIndex i = len;
65 *jtypes++ = FRIBIDI_GET_JOINING_TYPE (*str);
70 FRIBIDI_ENTRY const char *
71 fribidi_get_joining_type_name (
78 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE);
79 # include "fribidi-joining-types-list.h"
80 # undef _FRIBIDI_ADD_TYPE
89 fribidi_char_from_joining_type (
92 fribidi_boolean visual
95 /* switch left and right if on visual run */
96 if (visual & ((FRIBIDI_JOINS_RIGHT (j) && !FRIBIDI_JOINS_LEFT (j)) |
97 (!FRIBIDI_JOINS_RIGHT (j) && FRIBIDI_JOINS_LEFT (j))))
98 j ^= FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT;
100 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
101 if (FRIBIDI_IS_JOINING_TYPE_##TYPE(j)) return SYMBOL;
102 # include "fribidi-joining-types-list.h"
103 # undef _FRIBIDI_ADD_TYPE
110 /* Editor directions:
111 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent