|
1 /* gunibreak.c - line break properties |
|
2 * Copyright 2000 Red Hat, Inc. |
|
3 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved. |
|
4 * |
|
5 * The Gnome Library is free software; you can redistribute it and/or |
|
6 * modify it under the terms of the GNU Lesser General Public License as |
|
7 * published by the Free Software Foundation; either version 2 of the |
|
8 * License, or (at your option) any later version. |
|
9 * |
|
10 * The Gnome Library is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 * Lesser General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU Lesser General Public |
|
16 * License along with the Gnome Library; see the file COPYING.LIB. If not, |
|
17 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
18 * Boston, MA 02111-1307, USA. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #include <stdlib.h> |
|
24 |
|
25 #include "glib.h" |
|
26 #include "gunibreak.h" |
|
27 #include "galias.h" |
|
28 |
|
29 #define TPROP_PART1(Page, Char) \ |
|
30 ((break_property_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ |
|
31 ? (break_property_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \ |
|
32 : (break_property_data[break_property_table_part1[Page]][Char])) |
|
33 |
|
34 #define TPROP_PART2(Page, Char) \ |
|
35 ((break_property_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ |
|
36 ? (break_property_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \ |
|
37 : (break_property_data[break_property_table_part2[Page]][Char])) |
|
38 |
|
39 #define PROP(Char) \ |
|
40 (((Char) <= G_UNICODE_LAST_CHAR_PART1) \ |
|
41 ? TPROP_PART1 ((Char) >> 8, (Char) & 0xff) \ |
|
42 : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \ |
|
43 ? TPROP_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \ |
|
44 : G_UNICODE_BREAK_UNKNOWN)) |
|
45 |
|
46 /** |
|
47 * g_unichar_break_type: |
|
48 * @c: a Unicode character |
|
49 * |
|
50 * Determines the break type of @c. @c should be a Unicode character |
|
51 * (to derive a character from UTF-8 encoded text, use |
|
52 * g_utf8_get_char()). The break type is used to find word and line |
|
53 * breaks ("text boundaries"), Pango implements the Unicode boundary |
|
54 * resolution algorithms and normally you would use a function such |
|
55 * as pango_break() instead of caring about break types yourself. |
|
56 * |
|
57 * Return value: the break type of @c |
|
58 **/ |
|
59 EXPORT_C GUnicodeBreakType |
|
60 g_unichar_break_type (gunichar c) |
|
61 { |
|
62 return PROP (c); |
|
63 } |
|
64 |
|
65 #define __G_UNIBREAK_C__ |
|
66 #include "galiasdef.c" |