1/*
2 * Copyright © 2009 Red Hat, Inc.
3 * Copyright © 2011 Codethink Limited
4 * Copyright © 2011,2012 Google, Inc.
5 *
6 * This is part of HarfBuzz, a text shaping library.
7 *
8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the
11 * above copyright notice and the following two paragraphs appear in
12 * all copies of this software.
13 *
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * DAMAGE.
19 *
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 *
26 * Red Hat Author(s): Behdad Esfahbod
27 * Codethink Author(s): Ryan Lortie
28 * Google Author(s): Behdad Esfahbod
29 */
30
31#ifndef HB_H_IN
32#error "Include <hb.h> instead."
33#endif
34
35#ifndef HB_UNICODE_H
36#define HB_UNICODE_H
37
38#include "hb-common.h"
39
40HB_BEGIN_DECLS
41
42
43/**
44 * HB_UNICODE_MAX
45 *
46 * Since: 1.9.0
47 **/
48#define HB_UNICODE_MAX 0x10FFFFu
49
50
51/**
52 * hb_unicode_general_category_t:
53 * @HB_UNICODE_GENERAL_CATEGORY_CONTROL: [Cc]
54 * @HB_UNICODE_GENERAL_CATEGORY_FORMAT: [Cf]
55 * @HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED: [Cn]
56 * @HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE: [Co]
57 * @HB_UNICODE_GENERAL_CATEGORY_SURROGATE: [Cs]
58 * @HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER: [Ll]
59 * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER: [Lm]
60 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER: [Lo]
61 * @HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER: [Lt]
62 * @HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER: [Lu]
63 * @HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK: [Mc]
64 * @HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK: [Me]
65 * @HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK: [Mn]
66 * @HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER: [Nd]
67 * @HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER: [Nl]
68 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER: [No]
69 * @HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION: [Pc]
70 * @HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION: [Pd]
71 * @HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION: [Pe]
72 * @HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION: [Pf]
73 * @HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION: [Pi]
74 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION: [Po]
75 * @HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION: [Ps]
76 * @HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL: [Sc]
77 * @HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL: [Sk]
78 * @HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL: [Sm]
79 * @HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL: [So]
80 * @HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR: [Zl]
81 * @HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR: [Zp]
82 * @HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR: [Zs]
83 *
84 * Data type for the "General_Category" (gc) property from
85 * the Unicode Character Database.
86 **/
87
88/* Unicode Character Database property: General_Category (gc) */
89typedef enum
90{
91 HB_UNICODE_GENERAL_CATEGORY_CONTROL, /* Cc */
92 HB_UNICODE_GENERAL_CATEGORY_FORMAT, /* Cf */
93 HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED, /* Cn */
94 HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE, /* Co */
95 HB_UNICODE_GENERAL_CATEGORY_SURROGATE, /* Cs */
96 HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER, /* Ll */
97 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER, /* Lm */
98 HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER, /* Lo */
99 HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER, /* Lt */
100 HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER, /* Lu */
101 HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK, /* Mc */
102 HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK, /* Me */
103 HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK, /* Mn */
104 HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER, /* Nd */
105 HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER, /* Nl */
106 HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER, /* No */
107 HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION, /* Pc */
108 HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION, /* Pd */
109 HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION, /* Pe */
110 HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION, /* Pf */
111 HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION, /* Pi */
112 HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION, /* Po */
113 HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION, /* Ps */
114 HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL, /* Sc */
115 HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL, /* Sk */
116 HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL, /* Sm */
117 HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL, /* So */
118 HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR, /* Zl */
119 HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR, /* Zp */
120 HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR /* Zs */
121} hb_unicode_general_category_t;
122
123/**
124 * hb_unicode_combining_class_t:
125 * @HB_UNICODE_COMBINING_CLASS_NOT_REORDERED: Spacing and enclosing marks; also many vowel and consonant signs, even if nonspacing
126 * @HB_UNICODE_COMBINING_CLASS_OVERLAY: Marks which overlay a base letter or symbol
127 * @HB_UNICODE_COMBINING_CLASS_NUKTA: Diacritic nukta marks in Brahmi-derived scripts
128 * @HB_UNICODE_COMBINING_CLASS_KANA_VOICING: Hiragana/Katakana voicing marks
129 * @HB_UNICODE_COMBINING_CLASS_VIRAMA: Viramas
130 * @HB_UNICODE_COMBINING_CLASS_CCC10: [Hebrew]
131 * @HB_UNICODE_COMBINING_CLASS_CCC11: [Hebrew]
132 * @HB_UNICODE_COMBINING_CLASS_CCC12: [Hebrew]
133 * @HB_UNICODE_COMBINING_CLASS_CCC13: [Hebrew]
134 * @HB_UNICODE_COMBINING_CLASS_CCC14: [Hebrew]
135 * @HB_UNICODE_COMBINING_CLASS_CCC15: [Hebrew]
136 * @HB_UNICODE_COMBINING_CLASS_CCC16: [Hebrew]
137 * @HB_UNICODE_COMBINING_CLASS_CCC17: [Hebrew]
138 * @HB_UNICODE_COMBINING_CLASS_CCC18: [Hebrew]
139 * @HB_UNICODE_COMBINING_CLASS_CCC19: [Hebrew]
140 * @HB_UNICODE_COMBINING_CLASS_CCC20: [Hebrew]
141 * @HB_UNICODE_COMBINING_CLASS_CCC21: [Hebrew]
142 * @HB_UNICODE_COMBINING_CLASS_CCC22: [Hebrew]
143 * @HB_UNICODE_COMBINING_CLASS_CCC23: [Hebrew]
144 * @HB_UNICODE_COMBINING_CLASS_CCC24: [Hebrew]
145 * @HB_UNICODE_COMBINING_CLASS_CCC25: [Hebrew]
146 * @HB_UNICODE_COMBINING_CLASS_CCC26: [Hebrew]
147 * @HB_UNICODE_COMBINING_CLASS_CCC27: [Arabic]
148 * @HB_UNICODE_COMBINING_CLASS_CCC28: [Arabic]
149 * @HB_UNICODE_COMBINING_CLASS_CCC29: [Arabic]
150 * @HB_UNICODE_COMBINING_CLASS_CCC30: [Arabic]
151 * @HB_UNICODE_COMBINING_CLASS_CCC31: [Arabic]
152 * @HB_UNICODE_COMBINING_CLASS_CCC32: [Arabic]
153 * @HB_UNICODE_COMBINING_CLASS_CCC33: [Arabic]
154 * @HB_UNICODE_COMBINING_CLASS_CCC34: [Arabic]
155 * @HB_UNICODE_COMBINING_CLASS_CCC35: [Arabic]
156 * @HB_UNICODE_COMBINING_CLASS_CCC36: [Syriac]
157 * @HB_UNICODE_COMBINING_CLASS_CCC84: [Telugu]
158 * @HB_UNICODE_COMBINING_CLASS_CCC91: [Telugu]
159 * @HB_UNICODE_COMBINING_CLASS_CCC103: [Thai]
160 * @HB_UNICODE_COMBINING_CLASS_CCC107: [Thai]
161 * @HB_UNICODE_COMBINING_CLASS_CCC118: [Lao]
162 * @HB_UNICODE_COMBINING_CLASS_CCC122: [Lao]
163 * @HB_UNICODE_COMBINING_CLASS_CCC129: [Tibetan]
164 * @HB_UNICODE_COMBINING_CLASS_CCC130: [Tibetan]
165 * @HB_UNICODE_COMBINING_CLASS_CCC133: [Tibetan]
166 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT: Marks attached at the bottom left
167 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW: Marks attached directly below
168 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE: Marks attached directly above
169 * @HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT: Marks attached at the top right
170 * @HB_UNICODE_COMBINING_CLASS_BELOW_LEFT: Distinct marks at the bottom left
171 * @HB_UNICODE_COMBINING_CLASS_BELOW: Distinct marks directly below
172 * @HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT: Distinct marks at the bottom right
173 * @HB_UNICODE_COMBINING_CLASS_LEFT: Distinct marks to the left
174 * @HB_UNICODE_COMBINING_CLASS_RIGHT: Distinct marks to the right
175 * @HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT: Distinct marks at the top left
176 * @HB_UNICODE_COMBINING_CLASS_ABOVE: Distinct marks directly above
177 * @HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT: Distinct marks at the top right
178 * @HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW: Distinct marks subtending two bases
179 * @HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE: Distinct marks extending above two bases
180 * @HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT: Greek iota subscript only
181 * @HB_UNICODE_COMBINING_CLASS_INVALID: Invalid combining class
182 *
183 * Data type for the Canonical_Combining_Class (ccc) property
184 * from the Unicode Character Database.
185 *
186 * <note>Note: newer versions of Unicode may add new values.
187 * Client programs should be ready to handle any value in the 0..254 range
188 * being returned from hb_unicode_combining_class().</note>
189 *
190 **/
191typedef enum
192{
193 HB_UNICODE_COMBINING_CLASS_NOT_REORDERED = 0,
194 HB_UNICODE_COMBINING_CLASS_OVERLAY = 1,
195 HB_UNICODE_COMBINING_CLASS_NUKTA = 7,
196 HB_UNICODE_COMBINING_CLASS_KANA_VOICING = 8,
197 HB_UNICODE_COMBINING_CLASS_VIRAMA = 9,
198
199 /* Hebrew */
200 HB_UNICODE_COMBINING_CLASS_CCC10 = 10,
201 HB_UNICODE_COMBINING_CLASS_CCC11 = 11,
202 HB_UNICODE_COMBINING_CLASS_CCC12 = 12,
203 HB_UNICODE_COMBINING_CLASS_CCC13 = 13,
204 HB_UNICODE_COMBINING_CLASS_CCC14 = 14,
205 HB_UNICODE_COMBINING_CLASS_CCC15 = 15,
206 HB_UNICODE_COMBINING_CLASS_CCC16 = 16,
207 HB_UNICODE_COMBINING_CLASS_CCC17 = 17,
208 HB_UNICODE_COMBINING_CLASS_CCC18 = 18,
209 HB_UNICODE_COMBINING_CLASS_CCC19 = 19,
210 HB_UNICODE_COMBINING_CLASS_CCC20 = 20,
211 HB_UNICODE_COMBINING_CLASS_CCC21 = 21,
212 HB_UNICODE_COMBINING_CLASS_CCC22 = 22,
213 HB_UNICODE_COMBINING_CLASS_CCC23 = 23,
214 HB_UNICODE_COMBINING_CLASS_CCC24 = 24,
215 HB_UNICODE_COMBINING_CLASS_CCC25 = 25,
216 HB_UNICODE_COMBINING_CLASS_CCC26 = 26,
217
218 /* Arabic */
219 HB_UNICODE_COMBINING_CLASS_CCC27 = 27,
220 HB_UNICODE_COMBINING_CLASS_CCC28 = 28,
221 HB_UNICODE_COMBINING_CLASS_CCC29 = 29,
222 HB_UNICODE_COMBINING_CLASS_CCC30 = 30,
223 HB_UNICODE_COMBINING_CLASS_CCC31 = 31,
224 HB_UNICODE_COMBINING_CLASS_CCC32 = 32,
225 HB_UNICODE_COMBINING_CLASS_CCC33 = 33,
226 HB_UNICODE_COMBINING_CLASS_CCC34 = 34,
227 HB_UNICODE_COMBINING_CLASS_CCC35 = 35,
228
229 /* Syriac */
230 HB_UNICODE_COMBINING_CLASS_CCC36 = 36,
231
232 /* Telugu */
233 HB_UNICODE_COMBINING_CLASS_CCC84 = 84,
234 HB_UNICODE_COMBINING_CLASS_CCC91 = 91,
235
236 /* Thai */
237 HB_UNICODE_COMBINING_CLASS_CCC103 = 103,
238 HB_UNICODE_COMBINING_CLASS_CCC107 = 107,
239
240 /* Lao */
241 HB_UNICODE_COMBINING_CLASS_CCC118 = 118,
242 HB_UNICODE_COMBINING_CLASS_CCC122 = 122,
243
244 /* Tibetan */
245 HB_UNICODE_COMBINING_CLASS_CCC129 = 129,
246 HB_UNICODE_COMBINING_CLASS_CCC130 = 130,
247 HB_UNICODE_COMBINING_CLASS_CCC133 = 132,
248
249
250 HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT = 200,
251 HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW = 202,
252 HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE = 214,
253 HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT = 216,
254 HB_UNICODE_COMBINING_CLASS_BELOW_LEFT = 218,
255 HB_UNICODE_COMBINING_CLASS_BELOW = 220,
256 HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT = 222,
257 HB_UNICODE_COMBINING_CLASS_LEFT = 224,
258 HB_UNICODE_COMBINING_CLASS_RIGHT = 226,
259 HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT = 228,
260 HB_UNICODE_COMBINING_CLASS_ABOVE = 230,
261 HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT = 232,
262 HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW = 233,
263 HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE = 234,
264
265 HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT = 240,
266
267 HB_UNICODE_COMBINING_CLASS_INVALID = 255
268} hb_unicode_combining_class_t;
269
270
271/*
272 * hb_unicode_funcs_t
273 */
274
275/**
276 * hb_unicode_funcs_t:
277 *
278 * Data type containing a set of virtual methods used for
279 * accessing various Unicode character properties.
280 *
281 * HarfBuzz provides a default function for each of the
282 * methods in #hb_unicode_funcs_t. Client programs can implement
283 * their own replacements for the individual Unicode functions, as
284 * needed, and replace the default by calling the setter for a
285 * method.
286 **/
287typedef struct hb_unicode_funcs_t hb_unicode_funcs_t;
288
289
290/*
291 * just give me the best implementation you've got there.
292 */
293HB_EXTERN hb_unicode_funcs_t *
294hb_unicode_funcs_get_default (void);
295
296
297HB_EXTERN hb_unicode_funcs_t *
298hb_unicode_funcs_create (hb_unicode_funcs_t *parent);
299
300HB_EXTERN hb_unicode_funcs_t *
301hb_unicode_funcs_get_empty (void);
302
303HB_EXTERN hb_unicode_funcs_t *
304hb_unicode_funcs_reference (hb_unicode_funcs_t *ufuncs);
305
306HB_EXTERN void
307hb_unicode_funcs_destroy (hb_unicode_funcs_t *ufuncs);
308
309HB_EXTERN hb_bool_t
310hb_unicode_funcs_set_user_data (hb_unicode_funcs_t *ufuncs,
311 hb_user_data_key_t *key,
312 void * data,
313 hb_destroy_func_t destroy,
314 hb_bool_t replace);
315
316
317HB_EXTERN void *
318hb_unicode_funcs_get_user_data (hb_unicode_funcs_t *ufuncs,
319 hb_user_data_key_t *key);
320
321
322HB_EXTERN void
323hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs);
324
325HB_EXTERN hb_bool_t
326hb_unicode_funcs_is_immutable (hb_unicode_funcs_t *ufuncs);
327
328HB_EXTERN hb_unicode_funcs_t *
329hb_unicode_funcs_get_parent (hb_unicode_funcs_t *ufuncs);
330
331
332/*
333 * funcs
334 */
335
336/* typedefs */
337
338/**
339 * hb_unicode_combining_class_func_t:
340 * @ufuncs: A Unicode-functions structure
341 * @unicode: The code point to query
342 * @user_data: User data pointer passed by the caller
343 *
344 * A virtual method for the #hb_unicode_funcs_t structure.
345 *
346 * This method should retrieve the Canonical Combining Class (ccc)
347 * property for a specified Unicode code point.
348 *
349 * Return value: The #hb_unicode_combining_class_t of @unicode
350 *
351 **/
352typedef hb_unicode_combining_class_t (*hb_unicode_combining_class_func_t) (hb_unicode_funcs_t *ufuncs,
353 hb_codepoint_t unicode,
354 void *user_data);
355
356/**
357 * hb_unicode_general_category_func_t:
358 * @ufuncs: A Unicode-functions structure
359 * @unicode: The code point to query
360 * @user_data: User data pointer passed by the caller
361 *
362 * A virtual method for the #hb_unicode_funcs_t structure.
363 *
364 * This method should retrieve the General Category property for
365 * a specified Unicode code point.
366 *
367 * Return value: The #hb_unicode_general_category_t of @unicode
368 *
369 **/
370typedef hb_unicode_general_category_t (*hb_unicode_general_category_func_t) (hb_unicode_funcs_t *ufuncs,
371 hb_codepoint_t unicode,
372 void *user_data);
373
374/**
375 * hb_unicode_mirroring_func_t:
376 * @ufuncs: A Unicode-functions structure
377 * @unicode: The code point to query
378 * @user_data: User data pointer passed by the caller
379 *
380 * A virtual method for the #hb_unicode_funcs_t structure.
381 *
382 * This method should retrieve the Bi-Directional Mirroring Glyph
383 * code point for a specified Unicode code point.
384 *
385 * <note>Note: If a code point does not have a specified
386 * Bi-Directional Mirroring Glyph defined, the method should
387 * return the original code point.</note>
388 *
389 * Return value: The #hb_codepoint_t of the Mirroring Glyph for @unicode
390 *
391 **/
392typedef hb_codepoint_t (*hb_unicode_mirroring_func_t) (hb_unicode_funcs_t *ufuncs,
393 hb_codepoint_t unicode,
394 void *user_data);
395
396/**
397 * hb_unicode_script_func_t:
398 * @ufuncs: A Unicode-functions structure
399 * @unicode: The code point to query
400 * @user_data: User data pointer passed by the caller
401 *
402 * A virtual method for the #hb_unicode_funcs_t structure.
403 *
404 * This method should retrieve the Script property for a
405 * specified Unicode code point.
406 *
407 * Return value: The #hb_script_t of @unicode
408 *
409 **/
410typedef hb_script_t (*hb_unicode_script_func_t) (hb_unicode_funcs_t *ufuncs,
411 hb_codepoint_t unicode,
412 void *user_data);
413
414/**
415 * hb_unicode_compose_func_t:
416 * @ufuncs: A Unicode-functions structure
417 * @a: The first code point to compose
418 * @b: The second code point to compose
419 * @ab: (out): The composed code point
420 * @user_data: user data pointer passed by the caller
421 *
422 * A virtual method for the #hb_unicode_funcs_t structure.
423 *
424 * This method should compose a sequence of two input Unicode code
425 * points by canonical equivalence, returning the composed code
426 * point in a #hb_codepoint_t output parameter (if successful).
427 * The method must return an #hb_bool_t indicating the success
428 * of the composition.
429 *
430 * Return value: True is @a,@b composed, false otherwise
431 *
432 **/
433typedef hb_bool_t (*hb_unicode_compose_func_t) (hb_unicode_funcs_t *ufuncs,
434 hb_codepoint_t a,
435 hb_codepoint_t b,
436 hb_codepoint_t *ab,
437 void *user_data);
438
439/**
440 * hb_unicode_decompose_func_t:
441 * @ufuncs: A Unicode-functions structure
442 * @ab: The code point to decompose
443 * @a: (out): The first decomposed code point
444 * @b: (out): The second decomposed code point
445 * @user_data: user data pointer passed by the caller
446 *
447 * A virtual method for the #hb_unicode_funcs_t structure.
448 *
449 * This method should decompose an input Unicode code point,
450 * returning the two decomposed code points in #hb_codepoint_t
451 * output parameters (if successful). The method must return an
452 * #hb_bool_t indicating the success of the composition.
453 *
454 * Return value: True if @ab decomposed, false otherwise
455 *
456 **/
457typedef hb_bool_t (*hb_unicode_decompose_func_t) (hb_unicode_funcs_t *ufuncs,
458 hb_codepoint_t ab,
459 hb_codepoint_t *a,
460 hb_codepoint_t *b,
461 void *user_data);
462
463/* func setters */
464
465/**
466 * hb_unicode_funcs_set_combining_class_func:
467 * @ufuncs: A Unicode-functions structure
468 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
469 * @user_data: Data to pass to @func
470 * @destroy: (optional): The function to call when @user_data is not needed anymore
471 *
472 * Sets the implementation function for #hb_unicode_combining_class_func_t.
473 *
474 * Since: 0.9.2
475 **/
476HB_EXTERN void
477hb_unicode_funcs_set_combining_class_func (hb_unicode_funcs_t *ufuncs,
478 hb_unicode_combining_class_func_t func,
479 void *user_data, hb_destroy_func_t destroy);
480
481/**
482 * hb_unicode_funcs_set_general_category_func:
483 * @ufuncs: A Unicode-functions structure
484 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
485 * @user_data: Data to pass to @func
486 * @destroy: (optional): The function to call when @user_data is not needed anymore
487 *
488 * Sets the implementation function for #hb_unicode_general_category_func_t.
489 *
490 * Since: 0.9.2
491 **/
492HB_EXTERN void
493hb_unicode_funcs_set_general_category_func (hb_unicode_funcs_t *ufuncs,
494 hb_unicode_general_category_func_t func,
495 void *user_data, hb_destroy_func_t destroy);
496
497/**
498 * hb_unicode_funcs_set_mirroring_func:
499 * @ufuncs: A Unicode-functions structure
500 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
501 * @user_data: Data to pass to @func
502 * @destroy: (optional): The function to call when @user_data is not needed anymore
503 *
504 * Sets the implementation function for #hb_unicode_mirroring_func_t.
505 *
506 * Since: 0.9.2
507 **/
508HB_EXTERN void
509hb_unicode_funcs_set_mirroring_func (hb_unicode_funcs_t *ufuncs,
510 hb_unicode_mirroring_func_t func,
511 void *user_data, hb_destroy_func_t destroy);
512
513/**
514 * hb_unicode_funcs_set_script_func:
515 * @ufuncs: A Unicode-functions structure
516 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
517 * @user_data: Data to pass to @func
518 * @destroy: (optional): The function to call when @user_data is not needed anymore
519 *
520 * Sets the implementation function for #hb_unicode_script_func_t.
521 *
522 * Since: 0.9.2
523 **/
524HB_EXTERN void
525hb_unicode_funcs_set_script_func (hb_unicode_funcs_t *ufuncs,
526 hb_unicode_script_func_t func,
527 void *user_data, hb_destroy_func_t destroy);
528
529/**
530 * hb_unicode_funcs_set_compose_func:
531 * @ufuncs: A Unicode-functions structure
532 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
533 * @user_data: Data to pass to @func
534 * @destroy: (optional): The function to call when @user_data is not needed anymore
535 *
536 * Sets the implementation function for #hb_unicode_compose_func_t.
537 *
538 * Since: 0.9.2
539 **/
540HB_EXTERN void
541hb_unicode_funcs_set_compose_func (hb_unicode_funcs_t *ufuncs,
542 hb_unicode_compose_func_t func,
543 void *user_data, hb_destroy_func_t destroy);
544
545/**
546 * hb_unicode_funcs_set_decompose_func:
547 * @ufuncs: A Unicode-functions structure
548 * @func: (closure user_data) (destroy destroy) (scope notified): The callback function to assign
549 * @user_data: Data to pass to @func
550 * @destroy: (optional): The function to call when @user_data is not needed anymore
551 *
552 * Sets the implementation function for #hb_unicode_decompose_func_t.
553 *
554 * Since: 0.9.2
555 **/
556HB_EXTERN void
557hb_unicode_funcs_set_decompose_func (hb_unicode_funcs_t *ufuncs,
558 hb_unicode_decompose_func_t func,
559 void *user_data, hb_destroy_func_t destroy);
560
561/* accessors */
562
563/**
564 * hb_unicode_combining_class:
565 * @ufuncs: The Unicode-functions structure
566 * @unicode: The code point to query
567 *
568 * Retrieves the Canonical Combining Class (ccc) property
569 * of code point @unicode.
570 *
571 * Return value: The #hb_unicode_combining_class_t of @unicode
572 *
573 * Since: 0.9.2
574 **/
575HB_EXTERN hb_unicode_combining_class_t
576hb_unicode_combining_class (hb_unicode_funcs_t *ufuncs,
577 hb_codepoint_t unicode);
578
579/**
580 * hb_unicode_general_category:
581 * @ufuncs: The Unicode-functions structure
582 * @unicode: The code point to query
583 *
584 * Retrieves the General Category (gc) property
585 * of code point @unicode.
586 *
587 * Return value: The #hb_unicode_general_category_t of @unicode
588 *
589 * Since: 0.9.2
590 **/
591HB_EXTERN hb_unicode_general_category_t
592hb_unicode_general_category (hb_unicode_funcs_t *ufuncs,
593 hb_codepoint_t unicode);
594
595/**
596 * hb_unicode_mirroring:
597 * @ufuncs: The Unicode-functions structure
598 * @unicode: The code point to query
599 *
600 * Retrieves the Bi-directional Mirroring Glyph code
601 * point defined for code point @unicode.
602 *
603 * Return value: The #hb_codepoint_t of the Mirroring Glyph for @unicode
604 *
605 * Since: 0.9.2
606 **/
607HB_EXTERN hb_codepoint_t
608hb_unicode_mirroring (hb_unicode_funcs_t *ufuncs,
609 hb_codepoint_t unicode);
610
611/**
612 * hb_unicode_script:
613 * @ufuncs: The Unicode-functions structure
614 * @unicode: The code point to query
615 *
616 * Retrieves the #hb_script_t script to which code
617 * point @unicode belongs.
618 *
619 * Return value: The #hb_script_t of @unicode
620 *
621 * Since: 0.9.2
622 **/
623HB_EXTERN hb_script_t
624hb_unicode_script (hb_unicode_funcs_t *ufuncs,
625 hb_codepoint_t unicode);
626
627/**
628 * hb_unicode_compose:
629 * @ufuncs: The Unicode-functions structure
630 * @a: The first code point to compose
631 * @b: The second code point to compose
632 * @ab: (out): The composed code point
633 *
634 * Composes the code point sequence @a,@b by canonical equivalence into
635 * code point @ab.
636 *
637 * Return value: True is @a,@b composed, false otherwise
638 *
639 * Since: 0.9.2
640 **/
641HB_EXTERN hb_bool_t
642hb_unicode_compose (hb_unicode_funcs_t *ufuncs,
643 hb_codepoint_t a,
644 hb_codepoint_t b,
645 hb_codepoint_t *ab);
646
647/**
648 * hb_unicode_decompose:
649 * @ufuncs: The Unicode-functions structure
650 * @ab: The code point to decompose
651 * @a: (out): The first decomposed code point
652 * @b: (out): The second decomposed code point
653 *
654 * Decomposes code point @ab by canonical equivalence, into code points
655 * @a and @b.
656 *
657 * Return value: True if @ab decomposed, false otherwise
658 *
659 * Since: 0.9.2
660 **/
661HB_EXTERN hb_bool_t
662hb_unicode_decompose (hb_unicode_funcs_t *ufuncs,
663 hb_codepoint_t ab,
664 hb_codepoint_t *a,
665 hb_codepoint_t *b);
666
667HB_END_DECLS
668
669#endif /* HB_UNICODE_H */
670

source code of include/harfbuzz/hb-unicode.h