hb-unicode.h 22 KB

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