Imported Upstream version 1.0.8
[platform/upstream/fribidi.git] / lib / fribidi-shape.c
1 /* FriBidi
2  * fribidi-shape.c - shaping
3  *
4  * Authors:
5  *   Behdad Esfahbod, 2001, 2002, 2004
6  *   Dov Grobgeld, 1999, 2000
7  *
8  * Copyright (C) 2005 Behdad Esfahbod
9  * 
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.
14  * 
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.
19  * 
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
24  * 
25  * For licensing issues, contact <fribidi.license@gmail.com>.
26  */
27
28 #include "common.h"
29
30 #include <fribidi-shape.h>
31 #include <fribidi-mirroring.h>
32 #include <fribidi-arabic.h>
33
34
35 FRIBIDI_ENTRY void
36 fribidi_shape (
37   /* input */
38   FriBidiFlags flags,
39   const FriBidiLevel *embedding_levels,
40   const FriBidiStrIndex len,
41   /* input and output */
42   FriBidiArabicProp *ar_props,
43   FriBidiChar *str
44 )
45 {
46   if UNLIKELY
47     (len == 0 || !str) return;
48
49   DBG ("in fribidi_shape");
50
51   fribidi_assert (embedding_levels);
52
53   if (ar_props)
54     fribidi_shape_arabic (flags, embedding_levels, len, ar_props, str);
55
56   if (FRIBIDI_TEST_BITS (flags, FRIBIDI_FLAG_SHAPE_MIRRORING))
57     fribidi_shape_mirroring (embedding_levels, len, str);
58 }
59
60
61 /* Editor directions:
62  * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
63  */