1 
2 //          Copyright Ahmet Sait Koçak 2020.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          https://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.hb.bind.unicode;
8 
9 import bindbc.hb.bind.common;
10 
11 extern(C) @nogc nothrow:
12 
13 /**
14  * HB_UNICODE_MAX
15  *
16  * Since: 1.9.0
17  **/
18 enum HB_UNICODE_MAX = 0x10FFFFu;
19 
20 /* hb_unicode_general_category_t */
21 
22 /* Unicode Character Database property: General_Category (gc) */
23 enum : int
24 {
25     HB_UNICODE_GENERAL_CATEGORY_CONTROL = 0, /* Cc */
26     HB_UNICODE_GENERAL_CATEGORY_FORMAT = 1, /* Cf */
27     HB_UNICODE_GENERAL_CATEGORY_UNASSIGNED = 2, /* Cn */
28     HB_UNICODE_GENERAL_CATEGORY_PRIVATE_USE = 3, /* Co */
29     HB_UNICODE_GENERAL_CATEGORY_SURROGATE = 4, /* Cs */
30     HB_UNICODE_GENERAL_CATEGORY_LOWERCASE_LETTER = 5, /* Ll */
31     HB_UNICODE_GENERAL_CATEGORY_MODIFIER_LETTER = 6, /* Lm */
32     HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER = 7, /* Lo */
33     HB_UNICODE_GENERAL_CATEGORY_TITLECASE_LETTER = 8, /* Lt */
34     HB_UNICODE_GENERAL_CATEGORY_UPPERCASE_LETTER = 9, /* Lu */
35     HB_UNICODE_GENERAL_CATEGORY_SPACING_MARK = 10, /* Mc */
36     HB_UNICODE_GENERAL_CATEGORY_ENCLOSING_MARK = 11, /* Me */
37     HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK = 12, /* Mn */
38     HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER = 13, /* Nd */
39     HB_UNICODE_GENERAL_CATEGORY_LETTER_NUMBER = 14, /* Nl */
40     HB_UNICODE_GENERAL_CATEGORY_OTHER_NUMBER = 15, /* No */
41     HB_UNICODE_GENERAL_CATEGORY_CONNECT_PUNCTUATION = 16, /* Pc */
42     HB_UNICODE_GENERAL_CATEGORY_DASH_PUNCTUATION = 17, /* Pd */
43     HB_UNICODE_GENERAL_CATEGORY_CLOSE_PUNCTUATION = 18, /* Pe */
44     HB_UNICODE_GENERAL_CATEGORY_FINAL_PUNCTUATION = 19, /* Pf */
45     HB_UNICODE_GENERAL_CATEGORY_INITIAL_PUNCTUATION = 20, /* Pi */
46     HB_UNICODE_GENERAL_CATEGORY_OTHER_PUNCTUATION = 21, /* Po */
47     HB_UNICODE_GENERAL_CATEGORY_OPEN_PUNCTUATION = 22, /* Ps */
48     HB_UNICODE_GENERAL_CATEGORY_CURRENCY_SYMBOL = 23, /* Sc */
49     HB_UNICODE_GENERAL_CATEGORY_MODIFIER_SYMBOL = 24, /* Sk */
50     HB_UNICODE_GENERAL_CATEGORY_MATH_SYMBOL = 25, /* Sm */
51     HB_UNICODE_GENERAL_CATEGORY_OTHER_SYMBOL = 26, /* So */
52     HB_UNICODE_GENERAL_CATEGORY_LINE_SEPARATOR = 27, /* Zl */
53     HB_UNICODE_GENERAL_CATEGORY_PARAGRAPH_SEPARATOR = 28, /* Zp */
54     HB_UNICODE_GENERAL_CATEGORY_SPACE_SEPARATOR = 29 /* Zs */
55 }
56 alias hb_unicode_general_category_t = int;
57 
58 /* hb_unicode_combining_class_t */
59 
60 /* Note: newer versions of Unicode may add new values.  Clients should be ready to handle
61  * any value in the 0..254 range being returned from hb_unicode_combining_class().
62  */
63 
64 /* Unicode Character Database property: Canonical_Combining_Class (ccc) */
65 enum : int
66 {
67     HB_UNICODE_COMBINING_CLASS_NOT_REORDERED = 0,
68     HB_UNICODE_COMBINING_CLASS_OVERLAY = 1,
69     HB_UNICODE_COMBINING_CLASS_NUKTA = 7,
70     HB_UNICODE_COMBINING_CLASS_KANA_VOICING = 8,
71     HB_UNICODE_COMBINING_CLASS_VIRAMA = 9,
72 
73     /* Hebrew */
74     HB_UNICODE_COMBINING_CLASS_CCC10 = 10,
75     HB_UNICODE_COMBINING_CLASS_CCC11 = 11,
76     HB_UNICODE_COMBINING_CLASS_CCC12 = 12,
77     HB_UNICODE_COMBINING_CLASS_CCC13 = 13,
78     HB_UNICODE_COMBINING_CLASS_CCC14 = 14,
79     HB_UNICODE_COMBINING_CLASS_CCC15 = 15,
80     HB_UNICODE_COMBINING_CLASS_CCC16 = 16,
81     HB_UNICODE_COMBINING_CLASS_CCC17 = 17,
82     HB_UNICODE_COMBINING_CLASS_CCC18 = 18,
83     HB_UNICODE_COMBINING_CLASS_CCC19 = 19,
84     HB_UNICODE_COMBINING_CLASS_CCC20 = 20,
85     HB_UNICODE_COMBINING_CLASS_CCC21 = 21,
86     HB_UNICODE_COMBINING_CLASS_CCC22 = 22,
87     HB_UNICODE_COMBINING_CLASS_CCC23 = 23,
88     HB_UNICODE_COMBINING_CLASS_CCC24 = 24,
89     HB_UNICODE_COMBINING_CLASS_CCC25 = 25,
90     HB_UNICODE_COMBINING_CLASS_CCC26 = 26,
91 
92     /* Arabic */
93     HB_UNICODE_COMBINING_CLASS_CCC27 = 27,
94     HB_UNICODE_COMBINING_CLASS_CCC28 = 28,
95     HB_UNICODE_COMBINING_CLASS_CCC29 = 29,
96     HB_UNICODE_COMBINING_CLASS_CCC30 = 30,
97     HB_UNICODE_COMBINING_CLASS_CCC31 = 31,
98     HB_UNICODE_COMBINING_CLASS_CCC32 = 32,
99     HB_UNICODE_COMBINING_CLASS_CCC33 = 33,
100     HB_UNICODE_COMBINING_CLASS_CCC34 = 34,
101     HB_UNICODE_COMBINING_CLASS_CCC35 = 35,
102 
103     /* Syriac */
104     HB_UNICODE_COMBINING_CLASS_CCC36 = 36,
105 
106     /* Telugu */
107     HB_UNICODE_COMBINING_CLASS_CCC84 = 84,
108     HB_UNICODE_COMBINING_CLASS_CCC91 = 91,
109 
110     /* Thai */
111     HB_UNICODE_COMBINING_CLASS_CCC103 = 103,
112     HB_UNICODE_COMBINING_CLASS_CCC107 = 107,
113 
114     /* Lao */
115     HB_UNICODE_COMBINING_CLASS_CCC118 = 118,
116     HB_UNICODE_COMBINING_CLASS_CCC122 = 122,
117 
118     /* Tibetan */
119     HB_UNICODE_COMBINING_CLASS_CCC129 = 129,
120     HB_UNICODE_COMBINING_CLASS_CCC130 = 130,
121     HB_UNICODE_COMBINING_CLASS_CCC133 = 132,
122 
123     HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW_LEFT = 200,
124     HB_UNICODE_COMBINING_CLASS_ATTACHED_BELOW = 202,
125     HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE = 214,
126     HB_UNICODE_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT = 216,
127     HB_UNICODE_COMBINING_CLASS_BELOW_LEFT = 218,
128     HB_UNICODE_COMBINING_CLASS_BELOW = 220,
129     HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT = 222,
130     HB_UNICODE_COMBINING_CLASS_LEFT = 224,
131     HB_UNICODE_COMBINING_CLASS_RIGHT = 226,
132     HB_UNICODE_COMBINING_CLASS_ABOVE_LEFT = 228,
133     HB_UNICODE_COMBINING_CLASS_ABOVE = 230,
134     HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT = 232,
135     HB_UNICODE_COMBINING_CLASS_DOUBLE_BELOW = 233,
136     HB_UNICODE_COMBINING_CLASS_DOUBLE_ABOVE = 234,
137 
138     HB_UNICODE_COMBINING_CLASS_IOTA_SUBSCRIPT = 240,
139 
140     HB_UNICODE_COMBINING_CLASS_INVALID = 255
141 }
142 alias hb_unicode_combining_class_t = int;
143 
144 /*
145  * hb_unicode_funcs_t
146  */
147 
148 struct hb_unicode_funcs_t;
149 
150 /*
151  * just give me the best implementation you've got there.
152  */
153 version(BindHB_Static)
154     hb_unicode_funcs_t* hb_unicode_funcs_get_default ();
155 else
156 {
157     private alias fp_hb_unicode_funcs_get_default = hb_unicode_funcs_t* function ();
158     __gshared fp_hb_unicode_funcs_get_default hb_unicode_funcs_get_default;
159 }
160 
161 version(BindHB_Static)
162     hb_unicode_funcs_t* hb_unicode_funcs_create (hb_unicode_funcs_t* parent);
163 else
164 {
165     private alias fp_hb_unicode_funcs_create = hb_unicode_funcs_t* function (hb_unicode_funcs_t* parent);
166     __gshared fp_hb_unicode_funcs_create hb_unicode_funcs_create;
167 }
168 
169 version(BindHB_Static)
170     hb_unicode_funcs_t* hb_unicode_funcs_get_empty ();
171 else
172 {
173     private alias fp_hb_unicode_funcs_get_empty = hb_unicode_funcs_t* function ();
174     __gshared fp_hb_unicode_funcs_get_empty hb_unicode_funcs_get_empty;
175 }
176 
177 version(BindHB_Static)
178     hb_unicode_funcs_t* hb_unicode_funcs_reference (hb_unicode_funcs_t* ufuncs);
179 else
180 {
181     private alias fp_hb_unicode_funcs_reference = hb_unicode_funcs_t* function (hb_unicode_funcs_t* ufuncs);
182     __gshared fp_hb_unicode_funcs_reference hb_unicode_funcs_reference;
183 }
184 
185 version(BindHB_Static)
186     void hb_unicode_funcs_destroy (hb_unicode_funcs_t* ufuncs);
187 else
188 {
189     private alias fp_hb_unicode_funcs_destroy = void function (hb_unicode_funcs_t* ufuncs);
190     __gshared fp_hb_unicode_funcs_destroy hb_unicode_funcs_destroy;
191 }
192 
193 version(BindHB_Static)
194     hb_bool_t hb_unicode_funcs_set_user_data (
195         hb_unicode_funcs_t* ufuncs,
196         hb_user_data_key_t* key,
197         void* data,
198         hb_destroy_func_t destroy,
199         hb_bool_t replace);
200 else
201 {
202     private alias fp_hb_unicode_funcs_set_user_data = hb_bool_t function (
203         hb_unicode_funcs_t* ufuncs,
204         hb_user_data_key_t* key,
205         void* data,
206         hb_destroy_func_t destroy,
207         hb_bool_t replace);
208     __gshared fp_hb_unicode_funcs_set_user_data hb_unicode_funcs_set_user_data;
209 }
210 
211 version(BindHB_Static)
212     void* hb_unicode_funcs_get_user_data (
213         hb_unicode_funcs_t* ufuncs,
214         hb_user_data_key_t* key);
215 else
216 {
217     private alias fp_hb_unicode_funcs_get_user_data = void* function (
218         hb_unicode_funcs_t* ufuncs,
219         hb_user_data_key_t* key);
220     __gshared fp_hb_unicode_funcs_get_user_data hb_unicode_funcs_get_user_data;
221 }
222 
223 version(BindHB_Static)
224     void hb_unicode_funcs_make_immutable (hb_unicode_funcs_t* ufuncs);
225 else
226 {
227     private alias fp_hb_unicode_funcs_make_immutable = void function (hb_unicode_funcs_t* ufuncs);
228     __gshared fp_hb_unicode_funcs_make_immutable hb_unicode_funcs_make_immutable;
229 }
230 
231 version(BindHB_Static)
232     hb_bool_t hb_unicode_funcs_is_immutable (hb_unicode_funcs_t* ufuncs);
233 else
234 {
235     private alias fp_hb_unicode_funcs_is_immutable = hb_bool_t function (hb_unicode_funcs_t* ufuncs);
236     __gshared fp_hb_unicode_funcs_is_immutable hb_unicode_funcs_is_immutable;
237 }
238 
239 version(BindHB_Static)
240     hb_unicode_funcs_t* hb_unicode_funcs_get_parent (hb_unicode_funcs_t* ufuncs);
241 else
242 {
243     private alias fp_hb_unicode_funcs_get_parent = hb_unicode_funcs_t* function (hb_unicode_funcs_t* ufuncs);
244     __gshared fp_hb_unicode_funcs_get_parent hb_unicode_funcs_get_parent;
245 }
246 
247 /*
248  * funcs
249  */
250 
251 /* typedefs */
252 
253 alias hb_unicode_combining_class_func_t = hb_unicode_combining_class_t function (
254     hb_unicode_funcs_t* ufuncs,
255     hb_codepoint_t unicode,
256     void* user_data);
257 alias hb_unicode_general_category_func_t = hb_unicode_general_category_t function (
258     hb_unicode_funcs_t* ufuncs,
259     hb_codepoint_t unicode,
260     void* user_data);
261 alias hb_unicode_mirroring_func_t = hb_codepoint_t function (
262     hb_unicode_funcs_t* ufuncs,
263     hb_codepoint_t unicode,
264     void* user_data);
265 alias hb_unicode_script_func_t = hb_script_t function (
266     hb_unicode_funcs_t* ufuncs,
267     hb_codepoint_t unicode,
268     void* user_data);
269 
270 alias hb_unicode_compose_func_t = hb_bool_t function (
271     hb_unicode_funcs_t* ufuncs,
272     hb_codepoint_t a,
273     hb_codepoint_t b,
274     hb_codepoint_t* ab,
275     void* user_data);
276 alias hb_unicode_decompose_func_t = hb_bool_t function (
277     hb_unicode_funcs_t* ufuncs,
278     hb_codepoint_t ab,
279     hb_codepoint_t* a,
280     hb_codepoint_t* b,
281     void* user_data);
282 
283 /* setters */
284 
285 /**
286  * hb_unicode_funcs_set_combining_class_func:
287  * @ufuncs: a Unicode function structure
288  * @func: (closure user_data) (destroy destroy) (scope notified):
289  * @user_data:
290  * @destroy:
291  *
292  *
293  *
294  * Since: 0.9.2
295  **/
296 version(BindHB_Static)
297     void hb_unicode_funcs_set_combining_class_func (
298         hb_unicode_funcs_t* ufuncs,
299         hb_unicode_combining_class_func_t func,
300         void* user_data,
301         hb_destroy_func_t destroy);
302 else
303 {
304     private alias fp_hb_unicode_funcs_set_combining_class_func = void function (
305         hb_unicode_funcs_t* ufuncs,
306         hb_unicode_combining_class_func_t func,
307         void* user_data,
308         hb_destroy_func_t destroy);
309     __gshared fp_hb_unicode_funcs_set_combining_class_func hb_unicode_funcs_set_combining_class_func;
310 }
311 
312 /**
313  * hb_unicode_funcs_set_general_category_func:
314  * @ufuncs: a Unicode function structure
315  * @func: (closure user_data) (destroy destroy) (scope notified):
316  * @user_data:
317  * @destroy:
318  *
319  *
320  *
321  * Since: 0.9.2
322  **/
323 version(BindHB_Static)
324     void hb_unicode_funcs_set_general_category_func (
325         hb_unicode_funcs_t* ufuncs,
326         hb_unicode_general_category_func_t func,
327         void* user_data,
328         hb_destroy_func_t destroy);
329 else
330 {
331     private alias fp_hb_unicode_funcs_set_general_category_func = void function (
332         hb_unicode_funcs_t* ufuncs,
333         hb_unicode_general_category_func_t func,
334         void* user_data,
335         hb_destroy_func_t destroy);
336     __gshared fp_hb_unicode_funcs_set_general_category_func hb_unicode_funcs_set_general_category_func;
337 }
338 
339 /**
340  * hb_unicode_funcs_set_mirroring_func:
341  * @ufuncs: a Unicode function structure
342  * @func: (closure user_data) (destroy destroy) (scope notified):
343  * @user_data:
344  * @destroy:
345  *
346  *
347  *
348  * Since: 0.9.2
349  **/
350 version(BindHB_Static)
351     void hb_unicode_funcs_set_mirroring_func (
352         hb_unicode_funcs_t* ufuncs,
353         hb_unicode_mirroring_func_t func,
354         void* user_data,
355         hb_destroy_func_t destroy);
356 else
357 {
358     private alias fp_hb_unicode_funcs_set_mirroring_func = void function (
359         hb_unicode_funcs_t* ufuncs,
360         hb_unicode_mirroring_func_t func,
361         void* user_data,
362         hb_destroy_func_t destroy);
363     __gshared fp_hb_unicode_funcs_set_mirroring_func hb_unicode_funcs_set_mirroring_func;
364 }
365 
366 /**
367  * hb_unicode_funcs_set_script_func:
368  * @ufuncs: a Unicode function structure
369  * @func: (closure user_data) (destroy destroy) (scope notified):
370  * @user_data:
371  * @destroy:
372  *
373  *
374  *
375  * Since: 0.9.2
376  **/
377 version(BindHB_Static)
378     void hb_unicode_funcs_set_script_func (
379         hb_unicode_funcs_t* ufuncs,
380         hb_unicode_script_func_t func,
381         void* user_data,
382         hb_destroy_func_t destroy);
383 else
384 {
385     private alias fp_hb_unicode_funcs_set_script_func = void function (
386         hb_unicode_funcs_t* ufuncs,
387         hb_unicode_script_func_t func,
388         void* user_data,
389         hb_destroy_func_t destroy);
390     __gshared fp_hb_unicode_funcs_set_script_func hb_unicode_funcs_set_script_func;
391 }
392 
393 /**
394  * hb_unicode_funcs_set_compose_func:
395  * @ufuncs: a Unicode function structure
396  * @func: (closure user_data) (destroy destroy) (scope notified):
397  * @user_data:
398  * @destroy:
399  *
400  *
401  *
402  * Since: 0.9.2
403  **/
404 version(BindHB_Static)
405     void hb_unicode_funcs_set_compose_func (
406         hb_unicode_funcs_t* ufuncs,
407         hb_unicode_compose_func_t func,
408         void* user_data,
409         hb_destroy_func_t destroy);
410 else
411 {
412     private alias fp_hb_unicode_funcs_set_compose_func = void function (
413         hb_unicode_funcs_t* ufuncs,
414         hb_unicode_compose_func_t func,
415         void* user_data,
416         hb_destroy_func_t destroy);
417     __gshared fp_hb_unicode_funcs_set_compose_func hb_unicode_funcs_set_compose_func;
418 }
419 
420 /**
421  * hb_unicode_funcs_set_decompose_func:
422  * @ufuncs: a Unicode function structure
423  * @func: (closure user_data) (destroy destroy) (scope notified):
424  * @user_data:
425  * @destroy:
426  *
427  *
428  *
429  * Since: 0.9.2
430  **/
431 version(BindHB_Static)
432     void hb_unicode_funcs_set_decompose_func (
433         hb_unicode_funcs_t* ufuncs,
434         hb_unicode_decompose_func_t func,
435         void* user_data,
436         hb_destroy_func_t destroy);
437 else
438 {
439     private alias fp_hb_unicode_funcs_set_decompose_func = void function (
440         hb_unicode_funcs_t* ufuncs,
441         hb_unicode_decompose_func_t func,
442         void* user_data,
443         hb_destroy_func_t destroy);
444     __gshared fp_hb_unicode_funcs_set_decompose_func hb_unicode_funcs_set_decompose_func;
445 }
446 
447 /* accessors */
448 
449 /**
450  * hb_unicode_combining_class:
451  *
452  * Since: 0.9.2
453  **/
454 version(BindHB_Static)
455     hb_unicode_combining_class_t hb_unicode_combining_class (
456         hb_unicode_funcs_t* ufuncs,
457         hb_codepoint_t unicode);
458 else
459 {
460     private alias fp_hb_unicode_combining_class = hb_unicode_combining_class_t function (
461         hb_unicode_funcs_t* ufuncs,
462         hb_codepoint_t unicode);
463     __gshared fp_hb_unicode_combining_class hb_unicode_combining_class;
464 }
465 
466 /**
467  * hb_unicode_general_category:
468  *
469  * Since: 0.9.2
470  **/
471 version(BindHB_Static)
472     hb_unicode_general_category_t hb_unicode_general_category (
473         hb_unicode_funcs_t* ufuncs,
474         hb_codepoint_t unicode);
475 else
476 {
477     private alias fp_hb_unicode_general_category = hb_unicode_general_category_t function (
478         hb_unicode_funcs_t* ufuncs,
479         hb_codepoint_t unicode);
480     __gshared fp_hb_unicode_general_category hb_unicode_general_category;
481 }
482 
483 /**
484  * hb_unicode_mirroring:
485  *
486  * Since: 0.9.2
487  **/
488 version(BindHB_Static)
489     hb_codepoint_t hb_unicode_mirroring (
490         hb_unicode_funcs_t* ufuncs,
491         hb_codepoint_t unicode);
492 else
493 {
494     private alias fp_hb_unicode_mirroring = hb_codepoint_t function (
495         hb_unicode_funcs_t* ufuncs,
496         hb_codepoint_t unicode);
497     __gshared fp_hb_unicode_mirroring hb_unicode_mirroring;
498 }
499 
500 /**
501  * hb_unicode_script:
502  *
503  * Since: 0.9.2
504  **/
505 version(BindHB_Static)
506     hb_script_t hb_unicode_script (
507         hb_unicode_funcs_t* ufuncs,
508         hb_codepoint_t unicode);
509 else
510 {
511     private alias fp_hb_unicode_script = hb_script_t function (
512         hb_unicode_funcs_t* ufuncs,
513         hb_codepoint_t unicode);
514     __gshared fp_hb_unicode_script hb_unicode_script;
515 }
516 
517 version(BindHB_Static)
518     hb_bool_t hb_unicode_compose (
519         hb_unicode_funcs_t* ufuncs,
520         hb_codepoint_t a,
521         hb_codepoint_t b,
522         hb_codepoint_t* ab);
523 else
524 {
525     private alias fp_hb_unicode_compose = hb_bool_t function (
526         hb_unicode_funcs_t* ufuncs,
527         hb_codepoint_t a,
528         hb_codepoint_t b,
529         hb_codepoint_t* ab);
530     __gshared fp_hb_unicode_compose hb_unicode_compose;
531 }
532 
533 version(BindHB_Static)
534     hb_bool_t hb_unicode_decompose (
535         hb_unicode_funcs_t* ufuncs,
536         hb_codepoint_t ab,
537         hb_codepoint_t* a,
538         hb_codepoint_t* b);
539 else
540 {
541     private alias fp_hb_unicode_decompose = hb_bool_t function (
542         hb_unicode_funcs_t* ufuncs,
543         hb_codepoint_t ab,
544         hb_codepoint_t* a,
545         hb_codepoint_t* b);
546     __gshared fp_hb_unicode_decompose hb_unicode_decompose;
547 }