2 * fribidi-joining-types.c - character joining types
4 * $Id: fribidi-joining-types.c,v 1.5 2006-01-31 03:23:13 behdad Exp $
6 * $Date: 2006-01-31 03:23:13 $
8 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-joining-types.c,v $
11 * Behdad Esfahbod, 2001, 2002, 2004
13 * Copyright (C) 2004 Sharif FarsiWeb, Inc.
14 * Copyright (C) 2001,2002 Behdad Esfahbod
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License as published by the Free Software Foundation; either
19 * version 2.1 of the License, or (at your option) any later version.
21 * This library is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * Lesser General Public License for more details.
26 * You should have received a copy of the GNU Lesser General Public License
27 * along with this library, in a file named COPYING; if not, write to the
28 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
29 * Boston, MA 02110-1301, USA
31 * For licensing issues, contact <license@farsiweb.info>.
36 #include <fribidi-joining-types.h>
38 #include "joining-types.h"
40 enum FriBidiJoiningTypeShortEnum
42 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) TYPE = FRIBIDI_JOINING_TYPE_##TYPE,
43 # include "fribidi-joining-types-list.h"
44 # undef _FRIBIDI_ADD_TYPE
48 #include "joining-type.tab.i"
50 FRIBIDI_ENTRY FriBidiJoiningType
51 fribidi_get_joining_type (
56 return FRIBIDI_GET_JOINING_TYPE (ch);
60 fribidi_get_joining_types (
62 const FriBidiChar *str,
63 const FriBidiStrIndex len,
65 FriBidiJoiningType *jtypes
68 register FriBidiStrIndex i = len;
71 *jtypes++ = FRIBIDI_GET_JOINING_TYPE (*str);
76 FRIBIDI_ENTRY const char *
77 fribidi_get_joining_type_name (
84 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) case FRIBIDI_JOINING_TYPE_##TYPE: return STRINGIZE(TYPE);
85 # include "fribidi-joining-types-list.h"
86 # undef _FRIBIDI_ADD_TYPE
95 fribidi_char_from_joining_type (
98 fribidi_boolean visual
101 /* switch left and right if on visual run */
102 if (visual & ((FRIBIDI_JOINS_RIGHT (j) && !FRIBIDI_JOINS_LEFT (j)) |
103 (!FRIBIDI_JOINS_RIGHT (j) && FRIBIDI_JOINS_LEFT (j))))
104 j ^= FRIBIDI_MASK_JOINS_RIGHT | FRIBIDI_MASK_JOINS_LEFT;
106 # define _FRIBIDI_ADD_TYPE(TYPE,SYMBOL) \
107 if (FRIBIDI_IS_JOINING_TYPE_##TYPE(j)) return SYMBOL;
108 # include "fribidi-joining-types-list.h"
109 # undef _FRIBIDI_ADD_TYPE
116 /* Editor directions:
117 * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent