1 | /* fribidi-brackets.h - get bracket character property |
2 | * |
3 | * Copyright (C) 2004 Sharif FarsiWeb, Inc |
4 | * Copyright (C) 2001, 2002, 2004 Behdad Esfahbod |
5 | * Copyright (C) 1999, 2000, 2017 Dov Grobgeld |
6 | * |
7 | * This file is part of GNU FriBidi. |
8 | * |
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. |
13 | * |
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. |
18 | * |
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 |
22 | * |
23 | * For licensing issues, contact <fribidi.license@gmail.com> or write to |
24 | * Sharif FarsiWeb, Inc., PO Box 13445-389, Tehran, Iran. |
25 | * |
26 | * Author(s): |
27 | * Behdad Esfahbod, 2001, 2002, 2004 |
28 | * Dov Grobgeld, 1999, 2000, 2017 |
29 | */ |
30 | #ifndef _FRIBIDI_BRACKETS_H |
31 | #define _FRIBIDI_BRACKETS_H |
32 | |
33 | #include "fribidi-common.h" |
34 | |
35 | #include "fribidi-types.h" |
36 | #include "fribidi-bidi-types.h" |
37 | |
38 | #include "fribidi-begindecls.h" |
39 | |
40 | /* fribidi_get_bracket - get bracketed character |
41 | * |
42 | * This function finds the bracketed equivalent of a character as defined in |
43 | * the file BidiBrackets.txt of the Unicode Character Database available at |
44 | * http://www.unicode.org/Public/UNIDATA/BidiBrackets.txt. |
45 | * |
46 | * If the input character is a declared as a brackets character in the |
47 | * Unicode standard and has a bracketed equivalent. The matching bracketed |
48 | * character is put in the output, otherwise the input character itself is |
49 | * put. |
50 | * |
51 | * Returns: The bracket type of the character. Use the |
52 | * FRIBIDI_IS_BRACKET(FriBidiBracketType) to test if it is a valid |
53 | * property. |
54 | */ |
55 | FRIBIDI_ENTRY FriBidiBracketType fribidi_get_bracket ( |
56 | FriBidiChar ch /* input character */ |
57 | ); |
58 | |
59 | /* fribidi_get_bracket_types - get bracketed characters |
60 | * |
61 | * This function finds the bracketed characters of an string of characters. |
62 | * See fribidi_get_bracket() for more information about the bracketed |
63 | * characters returned by this function. |
64 | */ |
65 | FRIBIDI_ENTRY void |
66 | fribidi_get_bracket_types ( |
67 | const FriBidiChar *str, /* input string */ |
68 | const FriBidiStrIndex len, /* input string length */ |
69 | const FriBidiCharType *types, /* input bidi types */ |
70 | FriBidiBracketType *btypes /* output bracketed characters */ |
71 | ); |
72 | |
73 | #define FRIBIDI_BRACKET_OPEN_MASK 0x80000000 |
74 | #define FRIBIDI_BRACKET_ID_MASK 0x7fffffff |
75 | #define FRIBIDI_IS_BRACKET_OPEN(bt) ((bt & FRIBIDI_BRACKET_OPEN_MASK)>0) |
76 | #define FRIBIDI_BRACKET_ID(bt) ((bt & FRIBIDI_BRACKET_ID_MASK)) |
77 | |
78 | #include "fribidi-enddecls.h" |
79 | |
80 | #endif /* !_FRIBIDI_BRACKETS_H */ |
81 | /* Editor directions: |
82 | * Local Variables: |
83 | * mode: c |
84 | * c-basic-offset: 2 |
85 | * indent-tabs-mode: t |
86 | * tab-width: 8 |
87 | * End: |
88 | * vim: textwidth=78: autoindent: cindent: shiftwidth=2: tabstop=8: |
89 | */ |
90 | |