1 /* fribidi-mirroring.c - get mirrored character
3 * Copyright (C) 2004 Sharif FarsiWeb, Inc
4 * Copyright (C) 2001, 2002, 2004 Behdad Esfahbod
5 * Copyright (C) 1999, 2000 Dov Grobgeld
7 * This file is part of GNU FriBidi.
9 * GNU FriBidi is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GNU FriBidi is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with GNU FriBidi; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 * For licensing issues, contact <license@farsiweb.info> or write to
24 * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran.
26 /* $Id: fribidi-mirroring.c,v 1.15 2005-11-03 01:39:01 behdad Exp $
28 * $Date: 2005-11-03 01:39:01 $
30 * $Source: /home/behdad/src/fdo/fribidi/togit/git/../fribidi/fribidi2/lib/fribidi-mirroring.c,v $
33 * Behdad Esfahbod, 2001, 2002, 2004
34 * Dov Grobgeld, 1999, 2000
39 #include <fribidi-mirroring.h>
41 #include "mirroring.tab.i"
43 FRIBIDI_ENTRY fribidi_boolean
44 fribidi_get_mirror_char (
48 FriBidiChar *mirrored_ch
51 register FriBidiChar result;
52 result = FRIBIDI_GET_MIRRORING (ch);
54 *mirrored_ch = result;
55 return ch != result ? true : false;
60 fribidi_shape_mirroring (
62 const FriBidiLevel *embedding_levels,
63 const FriBidiStrIndex len,
64 /* input and output */
68 register FriBidiStrIndex i;
70 DBG ("in fribidi_shape_mirroring");
73 (len == 0 || !str) return;
75 fribidi_assert (embedding_levels);
77 /* L4. Mirror all characters that are in odd levels and have mirrors. */
78 for (i = len - 1; i >= 0; i--)
79 if (FRIBIDI_LEVEL_IS_RTL (embedding_levels[i]))
81 FriBidiChar mirrored_ch;
83 if (fribidi_get_mirror_char (str[i], &mirrored_ch))
95 * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8: