OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, Inc. |
3 * Copyright © 2011,2012 Google, Inc. | 3 * Copyright © 2011,2012 Google, Inc. |
4 * | 4 * |
5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
6 * | 6 * |
7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
(...skipping 15 matching lines...) Expand all Loading... |
26 * Google Author(s): Behdad Esfahbod | 26 * Google Author(s): Behdad Esfahbod |
27 */ | 27 */ |
28 | 28 |
29 #ifndef HB_H_IN | 29 #ifndef HB_H_IN |
30 #error "Include <hb.h> instead." | 30 #error "Include <hb.h> instead." |
31 #endif | 31 #endif |
32 | 32 |
33 #ifndef HB_COMMON_H | 33 #ifndef HB_COMMON_H |
34 #define HB_COMMON_H | 34 #define HB_COMMON_H |
35 | 35 |
| 36 #ifndef HB_BEGIN_DECLS |
36 # ifdef __cplusplus | 37 # ifdef __cplusplus |
37 # define HB_BEGIN_DECLS extern "C" { | 38 # define HB_BEGIN_DECLS extern "C" { |
38 # define HB_END_DECLS } | 39 # define HB_END_DECLS } |
39 # else /* !__cplusplus */ | 40 # else /* !__cplusplus */ |
40 # define HB_BEGIN_DECLS | 41 # define HB_BEGIN_DECLS |
41 # define HB_END_DECLS | 42 # define HB_END_DECLS |
42 # endif /* !__cplusplus */ | 43 # endif /* !__cplusplus */ |
43 | 44 #endif |
44 HB_BEGIN_DECLS | |
45 | 45 |
46 #if !defined (HB_DONT_DEFINE_STDINT) | 46 #if !defined (HB_DONT_DEFINE_STDINT) |
47 | 47 |
48 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \ | 48 #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \ |
49 defined (_sgi) || defined (__sun) || defined (sun) || \ | 49 defined (_sgi) || defined (__sun) || defined (sun) || \ |
50 defined (__digital__) || defined (__HP_cc) | 50 defined (__digital__) || defined (__HP_cc) |
51 # include <inttypes.h> | 51 # include <inttypes.h> |
52 #elif defined (_AIX) | 52 #elif defined (_AIX) |
53 # include <sys/inttypes.h> | 53 # include <sys/inttypes.h> |
54 /* VS 2010 (_MSC_VER 1600) has stdint.h */ | 54 /* VS 2010 (_MSC_VER 1600) has stdint.h */ |
55 #elif defined (_MSC_VER) && _MSC_VER < 1600 | 55 #elif defined (_MSC_VER) && _MSC_VER < 1600 |
56 typedef __int8 int8_t; | 56 typedef __int8 int8_t; |
57 typedef unsigned __int8 uint8_t; | 57 typedef unsigned __int8 uint8_t; |
58 typedef __int16 int16_t; | 58 typedef __int16 int16_t; |
59 typedef unsigned __int16 uint16_t; | 59 typedef unsigned __int16 uint16_t; |
60 typedef __int32 int32_t; | 60 typedef __int32 int32_t; |
61 typedef unsigned __int32 uint32_t; | 61 typedef unsigned __int32 uint32_t; |
62 typedef __int64 int64_t; | 62 typedef __int64 int64_t; |
63 typedef unsigned __int64 uint64_t; | 63 typedef unsigned __int64 uint64_t; |
64 #else | 64 #else |
65 # include <stdint.h> | 65 # include <stdint.h> |
66 #endif | 66 #endif |
67 | 67 |
68 #endif | 68 #endif |
69 | 69 |
| 70 HB_BEGIN_DECLS |
| 71 |
70 | 72 |
71 typedef int hb_bool_t; | 73 typedef int hb_bool_t; |
72 | 74 |
73 typedef uint32_t hb_codepoint_t; | 75 typedef uint32_t hb_codepoint_t; |
74 typedef int32_t hb_position_t; | 76 typedef int32_t hb_position_t; |
75 typedef uint32_t hb_mask_t; | 77 typedef uint32_t hb_mask_t; |
76 | 78 |
77 typedef union _hb_var_int_t { | 79 typedef union _hb_var_int_t { |
78 uint32_t u32; | 80 uint32_t u32; |
79 int32_t i32; | 81 int32_t i32; |
80 uint16_t u16[2]; | 82 uint16_t u16[2]; |
81 int16_t i16[2]; | 83 int16_t i16[2]; |
82 uint8_t u8[4]; | 84 uint8_t u8[4]; |
83 int8_t i8[4]; | 85 int8_t i8[4]; |
84 } hb_var_int_t; | 86 } hb_var_int_t; |
85 | 87 |
86 | 88 |
87 /* hb_tag_t */ | 89 /* hb_tag_t */ |
88 | 90 |
89 typedef uint32_t hb_tag_t; | 91 typedef uint32_t hb_tag_t; |
90 | 92 |
91 #define HB_TAG(a,b,c,d) ((hb_tag_t)((((uint8_t)(a))<<24)|(((uint8_t)(b))<<16)|((
(uint8_t)(c))<<8)|((uint8_t)(d)))) | 93 #define HB_TAG(a,b,c,d) ((hb_tag_t)((((uint8_t)(a))<<24)|(((uint8_t)(b))<<16)|((
(uint8_t)(c))<<8)|((uint8_t)(d)))) |
92 #define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_
t)((tag)>>8)), ((uint8_t)(tag)) | 94 #define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_
t)((tag)>>8)), ((uint8_t)(tag)) |
93 | 95 |
94 #define HB_TAG_NONE HB_TAG(0,0,0,0) | 96 #define HB_TAG_NONE HB_TAG(0,0,0,0) |
95 | 97 |
96 /* len=-1 means str is NUL-terminated */ | 98 /* len=-1 means str is NUL-terminated. */ |
97 hb_tag_t hb_tag_from_string (const char *str, int len); | 99 hb_tag_t |
| 100 hb_tag_from_string (const char *str, int len); |
| 101 |
| 102 /* buf should have 4 bytes. */ |
| 103 void |
| 104 hb_tag_to_string (hb_tag_t tag, char *buf); |
98 | 105 |
99 | 106 |
100 /* hb_direction_t */ | 107 /* hb_direction_t */ |
101 | 108 |
102 typedef enum { | 109 typedef enum { |
103 HB_DIRECTION_INVALID = 0, | 110 HB_DIRECTION_INVALID = 0, |
104 HB_DIRECTION_LTR = 4, | 111 HB_DIRECTION_LTR = 4, |
105 HB_DIRECTION_RTL, | 112 HB_DIRECTION_RTL, |
106 HB_DIRECTION_TTB, | 113 HB_DIRECTION_TTB, |
107 HB_DIRECTION_BTT | 114 HB_DIRECTION_BTT |
108 } hb_direction_t; | 115 } hb_direction_t; |
109 | 116 |
110 /* len=-1 means str is NUL-terminated */ | 117 /* len=-1 means str is NUL-terminated */ |
111 hb_direction_t | 118 hb_direction_t |
112 hb_direction_from_string (const char *str, int len); | 119 hb_direction_from_string (const char *str, int len); |
113 | 120 |
114 const char * | 121 const char * |
115 hb_direction_to_string (hb_direction_t direction); | 122 hb_direction_to_string (hb_direction_t direction); |
116 | 123 |
117 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4) | 124 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4) |
118 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) | 125 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) |
119 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) | 126 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) |
120 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) | 127 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) |
121 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4) | 128 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4) |
122 #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)
) ^ 1)) /* Direction must be valid */ | 129 #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)
) ^ 1)) /* Direction must be valid */ |
123 | 130 |
124 | 131 |
125 /* hb_language_t */ | 132 /* hb_language_t */ |
126 | 133 |
127 typedef struct _hb_language_t *hb_language_t; | 134 typedef struct hb_language_impl_t *hb_language_t; |
128 | 135 |
129 /* len=-1 means str is NUL-terminated */ | 136 /* len=-1 means str is NUL-terminated */ |
130 hb_language_t | 137 hb_language_t |
131 hb_language_from_string (const char *str, int len); | 138 hb_language_from_string (const char *str, int len); |
132 | 139 |
133 const char * | 140 const char * |
134 hb_language_to_string (hb_language_t language); | 141 hb_language_to_string (hb_language_t language); |
135 | 142 |
136 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL) | 143 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL) |
137 | 144 |
138 hb_language_t | 145 hb_language_t |
139 hb_language_get_default (void); | 146 hb_language_get_default (void); |
140 | 147 |
141 | 148 |
142 /* hb_unicode_general_category_t */ | |
143 | |
144 typedef enum | |
145 { | |
146 HB_UNICODE_GENERAL_CATEGORY_CONTROL, /* Cc */ | |
147 HB_UNICODE_GENERAL_CATEGORY_FORMAT, /* Cf */ | |
148 HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED, /* Cn */ | |
149 HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE, /* Co */ | |
150 HB_UNICODE_GENERAL_CATEGORY_SURROGATE, /* Cs */ | |
151 HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER, /* Ll */ | |
152 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER, /* Lm */ | |
153 HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER, /* Lo */ | |
154 HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER, /* Lt */ | |
155 HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER, /* Lu */ | |
156 HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK, /* Mc */ | |
157 HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK, /* Me */ | |
158 HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK, /* Mn */ | |
159 HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER, /* Nd */ | |
160 HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER, /* Nl */ | |
161 HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER, /* No */ | |
162 HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION, /* Pc */ | |
163 HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION, /* Pd */ | |
164 HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION, /* Pe */ | |
165 HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION, /* Pf */ | |
166 HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION, /* Pi */ | |
167 HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION, /* Po */ | |
168 HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION, /* Ps */ | |
169 HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL, /* Sc */ | |
170 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL, /* Sk */ | |
171 HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL, /* Sm */ | |
172 HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL, /* So */ | |
173 HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR, /* Zl */ | |
174 HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR, /* Zp */ | |
175 HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR /* Zs */ | |
176 } hb_unicode_general_category_t; | |
177 | |
178 | |
179 /* hb_script_t */ | 149 /* hb_script_t */ |
180 | 150 |
181 /* http://unicode.org/iso15924/ */ | 151 /* http://unicode.org/iso15924/ */ |
182 /* http://goo.gl/x9ilM */ | 152 /* http://goo.gl/x9ilM */ |
| 153 /* Unicode Character Database property: Script (sc) */ |
183 typedef enum | 154 typedef enum |
184 { | 155 { |
185 /* Unicode-1.1 additions */ | 156 /* Unicode-1.1 additions */ |
186 HB_SCRIPT_COMMON = HB_TAG ('Z','y','y','y'), | 157 HB_SCRIPT_COMMON = HB_TAG ('Z','y','y','y'), |
187 HB_SCRIPT_ARABIC = HB_TAG ('A','r','a','b'), | 158 HB_SCRIPT_ARABIC = HB_TAG ('A','r','a','b'), |
188 HB_SCRIPT_ARMENIAN = HB_TAG ('A','r','m','n'), | 159 HB_SCRIPT_ARMENIAN = HB_TAG ('A','r','m','n'), |
189 HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'), | 160 HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'), |
190 HB_SCRIPT_BOPOMOFO = HB_TAG ('B','o','p','o'), | 161 HB_SCRIPT_BOPOMOFO = HB_TAG ('B','o','p','o'), |
191 HB_SCRIPT_CANADIAN_ABORIGINAL = HB_TAG ('C','a','n','s'), | 162 HB_SCRIPT_CANADIAN_ABORIGINAL = HB_TAG ('C','a','n','s'), |
192 HB_SCRIPT_CHEROKEE = HB_TAG ('C','h','e','r'), | 163 HB_SCRIPT_CHEROKEE = HB_TAG ('C','h','e','r'), |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 297 |
327 hb_tag_t | 298 hb_tag_t |
328 hb_script_to_iso15924_tag (hb_script_t script); | 299 hb_script_to_iso15924_tag (hb_script_t script); |
329 | 300 |
330 hb_direction_t | 301 hb_direction_t |
331 hb_script_get_horizontal_direction (hb_script_t script); | 302 hb_script_get_horizontal_direction (hb_script_t script); |
332 | 303 |
333 | 304 |
334 /* User data */ | 305 /* User data */ |
335 | 306 |
336 typedef struct _hb_user_data_key_t { | 307 typedef struct hb_user_data_key_t { |
337 /*< private >*/ | 308 /*< private >*/ |
338 char unused; | 309 char unused; |
339 } hb_user_data_key_t; | 310 } hb_user_data_key_t; |
340 | 311 |
341 typedef void (*hb_destroy_func_t) (void *user_data); | 312 typedef void (*hb_destroy_func_t) (void *user_data); |
342 | 313 |
343 | 314 |
344 HB_END_DECLS | 315 HB_END_DECLS |
345 | 316 |
346 #endif /* HB_COMMON_H */ | 317 #endif /* HB_COMMON_H */ |
OLD | NEW |