hb-common.h 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. /*
  2. * Copyright © 2007,2008,2009 Red Hat, Inc.
  3. * Copyright © 2011,2012 Google, Inc.
  4. *
  5. * This is part of HarfBuzz, a text shaping library.
  6. *
  7. * Permission is hereby granted, without written agreement and without
  8. * license or royalty fees, to use, copy, modify, and distribute this
  9. * software and its documentation for any purpose, provided that the
  10. * above copyright notice and the following two paragraphs appear in
  11. * all copies of this software.
  12. *
  13. * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
  14. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  15. * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
  16. * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  17. * DAMAGE.
  18. *
  19. * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
  20. * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  21. * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  22. * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
  23. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  24. *
  25. * Red Hat Author(s): Behdad Esfahbod
  26. * Google Author(s): Behdad Esfahbod
  27. */
  28. #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
  29. #error "Include <hb.h> instead."
  30. #endif
  31. #ifndef HB_COMMON_H
  32. #define HB_COMMON_H
  33. #ifndef HB_EXTERN
  34. #define HB_EXTERN extern
  35. #endif
  36. #ifndef HB_BEGIN_DECLS
  37. # ifdef __cplusplus
  38. # define HB_BEGIN_DECLS extern "C" {
  39. # define HB_END_DECLS }
  40. # else /* !__cplusplus */
  41. # define HB_BEGIN_DECLS
  42. # define HB_END_DECLS
  43. # endif /* !__cplusplus */
  44. #endif
  45. #if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
  46. defined (_sgi) || defined (__sun) || defined (sun) || \
  47. defined (__digital__) || defined (__HP_cc)
  48. # include <inttypes.h>
  49. #elif defined (_AIX)
  50. # include <sys/inttypes.h>
  51. #elif defined (_MSC_VER) && _MSC_VER < 1600
  52. /* VS 2010 (_MSC_VER 1600) has stdint.h */
  53. typedef __int8 int8_t;
  54. typedef unsigned __int8 uint8_t;
  55. typedef __int16 int16_t;
  56. typedef unsigned __int16 uint16_t;
  57. typedef __int32 int32_t;
  58. typedef unsigned __int32 uint32_t;
  59. typedef __int64 int64_t;
  60. typedef unsigned __int64 uint64_t;
  61. #elif defined (__KERNEL__)
  62. # include <linux/types.h>
  63. #else
  64. # include <stdint.h>
  65. #endif
  66. #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
  67. #define HB_DEPRECATED __attribute__((__deprecated__))
  68. #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
  69. #define HB_DEPRECATED __declspec(deprecated)
  70. #else
  71. #define HB_DEPRECATED
  72. #endif
  73. #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
  74. #define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
  75. #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
  76. #define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
  77. #else
  78. #define HB_DEPRECATED_FOR(f) HB_DEPRECATED
  79. #endif
  80. HB_BEGIN_DECLS
  81. /**
  82. * hb_bool_t:
  83. *
  84. * Data type for booleans.
  85. *
  86. **/
  87. typedef int hb_bool_t;
  88. /**
  89. * hb_codepoint_t:
  90. *
  91. * Data type for holding Unicode codepoints. Also
  92. * used to hold glyph IDs.
  93. *
  94. **/
  95. typedef uint32_t hb_codepoint_t;
  96. /**
  97. * hb_position_t:
  98. *
  99. * Data type for holding a single coordinate value.
  100. * Contour points and other multi-dimensional data are
  101. * stored as tuples of #hb_position_t's.
  102. *
  103. **/
  104. typedef int32_t hb_position_t;
  105. /**
  106. * hb_mask_t:
  107. *
  108. * Data type for bitmasks.
  109. *
  110. **/
  111. typedef uint32_t hb_mask_t;
  112. typedef union _hb_var_int_t {
  113. uint32_t u32;
  114. int32_t i32;
  115. uint16_t u16[2];
  116. int16_t i16[2];
  117. uint8_t u8[4];
  118. int8_t i8[4];
  119. } hb_var_int_t;
  120. typedef union _hb_var_num_t {
  121. float f;
  122. uint32_t u32;
  123. int32_t i32;
  124. uint16_t u16[2];
  125. int16_t i16[2];
  126. uint8_t u8[4];
  127. int8_t i8[4];
  128. } hb_var_num_t;
  129. /* hb_tag_t */
  130. /**
  131. * hb_tag_t:
  132. *
  133. * Data type for tag identifiers. Tags are four
  134. * byte integers, each byte representing a character.
  135. *
  136. * Tags are used to identify tables, design-variation axes,
  137. * scripts, languages, font features, and baselines with
  138. * human-readable names.
  139. *
  140. **/
  141. typedef uint32_t hb_tag_t;
  142. /**
  143. * HB_TAG:
  144. * @c1: 1st character of the tag
  145. * @c2: 2nd character of the tag
  146. * @c3: 3rd character of the tag
  147. * @c4: 4th character of the tag
  148. *
  149. * Constructs an #hb_tag_t from four character literals.
  150. *
  151. **/
  152. #define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint32_t)(c1)&0xFF)<<24)|(((uint32_t)(c2)&0xFF)<<16)|(((uint32_t)(c3)&0xFF)<<8)|((uint32_t)(c4)&0xFF)))
  153. /**
  154. * HB_UNTAG:
  155. * @tag: an #hb_tag_t
  156. *
  157. * Extracts four character literals from an #hb_tag_t.
  158. *
  159. * Since: 0.6.0
  160. *
  161. **/
  162. #define HB_UNTAG(tag) (uint8_t)(((tag)>>24)&0xFF), (uint8_t)(((tag)>>16)&0xFF), (uint8_t)(((tag)>>8)&0xFF), (uint8_t)((tag)&0xFF)
  163. /**
  164. * HB_TAG_NONE:
  165. *
  166. * Unset #hb_tag_t.
  167. */
  168. #define HB_TAG_NONE HB_TAG(0,0,0,0)
  169. /**
  170. * HB_TAG_MAX:
  171. *
  172. * Maximum possible unsigned #hb_tag_t.
  173. *
  174. * Since: 0.9.26
  175. */
  176. #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
  177. /**
  178. * HB_TAG_MAX_SIGNED:
  179. *
  180. * Maximum possible signed #hb_tag_t.
  181. *
  182. * Since: 0.9.33
  183. */
  184. #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
  185. /* len=-1 means str is NUL-terminated. */
  186. HB_EXTERN hb_tag_t
  187. hb_tag_from_string (const char *str, int len);
  188. /* buf should have 4 bytes. */
  189. HB_EXTERN void
  190. hb_tag_to_string (hb_tag_t tag, char *buf);
  191. /**
  192. * hb_direction_t:
  193. * @HB_DIRECTION_INVALID: Initial, unset direction.
  194. * @HB_DIRECTION_LTR: Text is set horizontally from left to right.
  195. * @HB_DIRECTION_RTL: Text is set horizontally from right to left.
  196. * @HB_DIRECTION_TTB: Text is set vertically from top to bottom.
  197. * @HB_DIRECTION_BTT: Text is set vertically from bottom to top.
  198. *
  199. * The direction of a text segment or buffer.
  200. *
  201. * A segment can also be tested for horizontal or vertical
  202. * orientation (irrespective of specific direction) with
  203. * HB_DIRECTION_IS_HORIZONTAL() or HB_DIRECTION_IS_VERTICAL().
  204. *
  205. */
  206. typedef enum {
  207. HB_DIRECTION_INVALID = 0,
  208. HB_DIRECTION_LTR = 4,
  209. HB_DIRECTION_RTL,
  210. HB_DIRECTION_TTB,
  211. HB_DIRECTION_BTT
  212. } hb_direction_t;
  213. /* len=-1 means str is NUL-terminated */
  214. HB_EXTERN hb_direction_t
  215. hb_direction_from_string (const char *str, int len);
  216. HB_EXTERN const char *
  217. hb_direction_to_string (hb_direction_t direction);
  218. /**
  219. * HB_DIRECTION_IS_VALID:
  220. * @dir: #hb_direction_t to test
  221. *
  222. * Tests whether a text direction is valid.
  223. *
  224. **/
  225. #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
  226. /* Direction must be valid for the following */
  227. /**
  228. * HB_DIRECTION_IS_HORIZONTAL:
  229. * @dir: #hb_direction_t to test
  230. *
  231. * Tests whether a text direction is horizontal. Requires
  232. * that the direction be valid.
  233. *
  234. **/
  235. #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
  236. /**
  237. * HB_DIRECTION_IS_VERTICAL:
  238. * @dir: #hb_direction_t to test
  239. *
  240. * Tests whether a text direction is vertical. Requires
  241. * that the direction be valid.
  242. *
  243. **/
  244. #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
  245. /**
  246. * HB_DIRECTION_IS_FORWARD:
  247. * @dir: #hb_direction_t to test
  248. *
  249. * Tests whether a text direction moves forward (from left to right, or from
  250. * top to bottom). Requires that the direction be valid.
  251. *
  252. **/
  253. #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
  254. /**
  255. * HB_DIRECTION_IS_BACKWARD:
  256. * @dir: #hb_direction_t to test
  257. *
  258. * Tests whether a text direction moves backward (from right to left, or from
  259. * bottom to top). Requires that the direction be valid.
  260. *
  261. **/
  262. #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
  263. /**
  264. * HB_DIRECTION_REVERSE:
  265. * @dir: #hb_direction_t to reverse
  266. *
  267. * Reverses a text direction. Requires that the direction
  268. * be valid.
  269. *
  270. **/
  271. #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1))
  272. /* hb_language_t */
  273. /**
  274. * hb_language_t:
  275. *
  276. * Data type for languages. Each #hb_language_t corresponds to a BCP 47
  277. * language tag.
  278. *
  279. */
  280. typedef const struct hb_language_impl_t *hb_language_t;
  281. HB_EXTERN hb_language_t
  282. hb_language_from_string (const char *str, int len);
  283. HB_EXTERN const char *
  284. hb_language_to_string (hb_language_t language);
  285. /**
  286. * HB_LANGUAGE_INVALID:
  287. *
  288. * An unset #hb_language_t.
  289. *
  290. * Since: 0.6.0
  291. */
  292. #define HB_LANGUAGE_INVALID ((hb_language_t) 0)
  293. HB_EXTERN hb_language_t
  294. hb_language_get_default (void);
  295. HB_EXTERN hb_bool_t
  296. hb_language_matches (hb_language_t language,
  297. hb_language_t specific);
  298. /**
  299. * hb_script_t:
  300. * @HB_SCRIPT_COMMON: `Zyyy`
  301. * @HB_SCRIPT_INHERITED: `Zinh`
  302. * @HB_SCRIPT_UNKNOWN: `Zzzz`
  303. * @HB_SCRIPT_ARABIC: `Arab`
  304. * @HB_SCRIPT_ARMENIAN: `Armn`
  305. * @HB_SCRIPT_BENGALI: `Beng`
  306. * @HB_SCRIPT_CYRILLIC: `Cyrl`
  307. * @HB_SCRIPT_DEVANAGARI: `Deva`
  308. * @HB_SCRIPT_GEORGIAN: `Geor`
  309. * @HB_SCRIPT_GREEK: `Grek`
  310. * @HB_SCRIPT_GUJARATI: `Gujr`
  311. * @HB_SCRIPT_GURMUKHI: `Guru`
  312. * @HB_SCRIPT_HANGUL: `Hang`
  313. * @HB_SCRIPT_HAN: `Hani`
  314. * @HB_SCRIPT_HEBREW: `Hebr`
  315. * @HB_SCRIPT_HIRAGANA: `Hira`
  316. * @HB_SCRIPT_KANNADA: `Knda`
  317. * @HB_SCRIPT_KATAKANA: `Kana`
  318. * @HB_SCRIPT_LAO: `Laoo`
  319. * @HB_SCRIPT_LATIN: `Latn`
  320. * @HB_SCRIPT_MALAYALAM: `Mlym`
  321. * @HB_SCRIPT_ORIYA: `Orya`
  322. * @HB_SCRIPT_TAMIL: `Taml`
  323. * @HB_SCRIPT_TELUGU: `Telu`
  324. * @HB_SCRIPT_THAI: `Thai`
  325. * @HB_SCRIPT_TIBETAN: `Tibt`
  326. * @HB_SCRIPT_BOPOMOFO: `Bopo`
  327. * @HB_SCRIPT_BRAILLE: `Brai`
  328. * @HB_SCRIPT_CANADIAN_SYLLABICS: `Cans`
  329. * @HB_SCRIPT_CHEROKEE: `Cher`
  330. * @HB_SCRIPT_ETHIOPIC: `Ethi`
  331. * @HB_SCRIPT_KHMER: `Khmr`
  332. * @HB_SCRIPT_MONGOLIAN: `Mong`
  333. * @HB_SCRIPT_MYANMAR: `Mymr`
  334. * @HB_SCRIPT_OGHAM: `Ogam`
  335. * @HB_SCRIPT_RUNIC: `Runr`
  336. * @HB_SCRIPT_SINHALA: `Sinh`
  337. * @HB_SCRIPT_SYRIAC: `Syrc`
  338. * @HB_SCRIPT_THAANA: `Thaa`
  339. * @HB_SCRIPT_YI: `Yiii`
  340. * @HB_SCRIPT_DESERET: `Dsrt`
  341. * @HB_SCRIPT_GOTHIC: `Goth`
  342. * @HB_SCRIPT_OLD_ITALIC: `Ital`
  343. * @HB_SCRIPT_BUHID: `Buhd`
  344. * @HB_SCRIPT_HANUNOO: `Hano`
  345. * @HB_SCRIPT_TAGALOG: `Tglg`
  346. * @HB_SCRIPT_TAGBANWA: `Tagb`
  347. * @HB_SCRIPT_CYPRIOT: `Cprt`
  348. * @HB_SCRIPT_LIMBU: `Limb`
  349. * @HB_SCRIPT_LINEAR_B: `Linb`
  350. * @HB_SCRIPT_OSMANYA: `Osma`
  351. * @HB_SCRIPT_SHAVIAN: `Shaw`
  352. * @HB_SCRIPT_TAI_LE: `Tale`
  353. * @HB_SCRIPT_UGARITIC: `Ugar`
  354. * @HB_SCRIPT_BUGINESE: `Bugi`
  355. * @HB_SCRIPT_COPTIC: `Copt`
  356. * @HB_SCRIPT_GLAGOLITIC: `Glag`
  357. * @HB_SCRIPT_KHAROSHTHI: `Khar`
  358. * @HB_SCRIPT_NEW_TAI_LUE: `Talu`
  359. * @HB_SCRIPT_OLD_PERSIAN: `Xpeo`
  360. * @HB_SCRIPT_SYLOTI_NAGRI: `Sylo`
  361. * @HB_SCRIPT_TIFINAGH: `Tfng`
  362. * @HB_SCRIPT_BALINESE: `Bali`
  363. * @HB_SCRIPT_CUNEIFORM: `Xsux`
  364. * @HB_SCRIPT_NKO: `Nkoo`
  365. * @HB_SCRIPT_PHAGS_PA: `Phag`
  366. * @HB_SCRIPT_PHOENICIAN: `Phnx`
  367. * @HB_SCRIPT_CARIAN: `Cari`
  368. * @HB_SCRIPT_CHAM: `Cham`
  369. * @HB_SCRIPT_KAYAH_LI: `Kali`
  370. * @HB_SCRIPT_LEPCHA: `Lepc`
  371. * @HB_SCRIPT_LYCIAN: `Lyci`
  372. * @HB_SCRIPT_LYDIAN: `Lydi`
  373. * @HB_SCRIPT_OL_CHIKI: `Olck`
  374. * @HB_SCRIPT_REJANG: `Rjng`
  375. * @HB_SCRIPT_SAURASHTRA: `Saur`
  376. * @HB_SCRIPT_SUNDANESE: `Sund`
  377. * @HB_SCRIPT_VAI: `Vaii`
  378. * @HB_SCRIPT_AVESTAN: `Avst`
  379. * @HB_SCRIPT_BAMUM: `Bamu`
  380. * @HB_SCRIPT_EGYPTIAN_HIEROGLYPHS: `Egyp`
  381. * @HB_SCRIPT_IMPERIAL_ARAMAIC: `Armi`
  382. * @HB_SCRIPT_INSCRIPTIONAL_PAHLAVI: `Phli`
  383. * @HB_SCRIPT_INSCRIPTIONAL_PARTHIAN: `Prti`
  384. * @HB_SCRIPT_JAVANESE: `Java`
  385. * @HB_SCRIPT_KAITHI: `Kthi`
  386. * @HB_SCRIPT_LISU: `Lisu`
  387. * @HB_SCRIPT_MEETEI_MAYEK: `Mtei`
  388. * @HB_SCRIPT_OLD_SOUTH_ARABIAN: `Sarb`
  389. * @HB_SCRIPT_OLD_TURKIC: `Orkh`
  390. * @HB_SCRIPT_SAMARITAN: `Samr`
  391. * @HB_SCRIPT_TAI_THAM: `Lana`
  392. * @HB_SCRIPT_TAI_VIET: `Tavt`
  393. * @HB_SCRIPT_BATAK: `Batk`
  394. * @HB_SCRIPT_BRAHMI: `Brah`
  395. * @HB_SCRIPT_MANDAIC: `Mand`
  396. * @HB_SCRIPT_CHAKMA: `Cakm`
  397. * @HB_SCRIPT_MEROITIC_CURSIVE: `Merc`
  398. * @HB_SCRIPT_MEROITIC_HIEROGLYPHS: `Mero`
  399. * @HB_SCRIPT_MIAO: `Plrd`
  400. * @HB_SCRIPT_SHARADA: `Shrd`
  401. * @HB_SCRIPT_SORA_SOMPENG: `Sora`
  402. * @HB_SCRIPT_TAKRI: `Takr`
  403. * @HB_SCRIPT_BASSA_VAH: `Bass`, Since: 0.9.30
  404. * @HB_SCRIPT_CAUCASIAN_ALBANIAN: `Aghb`, Since: 0.9.30
  405. * @HB_SCRIPT_DUPLOYAN: `Dupl`, Since: 0.9.30
  406. * @HB_SCRIPT_ELBASAN: `Elba`, Since: 0.9.30
  407. * @HB_SCRIPT_GRANTHA: `Gran`, Since: 0.9.30
  408. * @HB_SCRIPT_KHOJKI: `Khoj`, Since: 0.9.30
  409. * @HB_SCRIPT_KHUDAWADI: `Sind`, Since: 0.9.30
  410. * @HB_SCRIPT_LINEAR_A: `Lina`, Since: 0.9.30
  411. * @HB_SCRIPT_MAHAJANI: `Mahj`, Since: 0.9.30
  412. * @HB_SCRIPT_MANICHAEAN: `Mani`, Since: 0.9.30
  413. * @HB_SCRIPT_MENDE_KIKAKUI: `Mend`, Since: 0.9.30
  414. * @HB_SCRIPT_MODI: `Modi`, Since: 0.9.30
  415. * @HB_SCRIPT_MRO: `Mroo`, Since: 0.9.30
  416. * @HB_SCRIPT_NABATAEAN: `Nbat`, Since: 0.9.30
  417. * @HB_SCRIPT_OLD_NORTH_ARABIAN: `Narb`, Since: 0.9.30
  418. * @HB_SCRIPT_OLD_PERMIC: `Perm`, Since: 0.9.30
  419. * @HB_SCRIPT_PAHAWH_HMONG: `Hmng`, Since: 0.9.30
  420. * @HB_SCRIPT_PALMYRENE: `Palm`, Since: 0.9.30
  421. * @HB_SCRIPT_PAU_CIN_HAU: `Pauc`, Since: 0.9.30
  422. * @HB_SCRIPT_PSALTER_PAHLAVI: `Phlp`, Since: 0.9.30
  423. * @HB_SCRIPT_SIDDHAM: `Sidd`, Since: 0.9.30
  424. * @HB_SCRIPT_TIRHUTA: `Tirh`, Since: 0.9.30
  425. * @HB_SCRIPT_WARANG_CITI: `Wara`, Since: 0.9.30
  426. * @HB_SCRIPT_AHOM: `Ahom`, Since: 0.9.30
  427. * @HB_SCRIPT_ANATOLIAN_HIEROGLYPHS: `Hluw`, Since: 0.9.30
  428. * @HB_SCRIPT_HATRAN: `Hatr`, Since: 0.9.30
  429. * @HB_SCRIPT_MULTANI: `Mult`, Since: 0.9.30
  430. * @HB_SCRIPT_OLD_HUNGARIAN: `Hung`, Since: 0.9.30
  431. * @HB_SCRIPT_SIGNWRITING: `Sgnw`, Since: 0.9.30
  432. * @HB_SCRIPT_ADLAM: `Adlm`, Since: 1.3.0
  433. * @HB_SCRIPT_BHAIKSUKI: `Bhks`, Since: 1.3.0
  434. * @HB_SCRIPT_MARCHEN: `Marc`, Since: 1.3.0
  435. * @HB_SCRIPT_OSAGE: `Osge`, Since: 1.3.0
  436. * @HB_SCRIPT_TANGUT: `Tang`, Since: 1.3.0
  437. * @HB_SCRIPT_NEWA: `Newa`, Since: 1.3.0
  438. * @HB_SCRIPT_MASARAM_GONDI: `Gonm`, Since: 1.6.0
  439. * @HB_SCRIPT_NUSHU: `Nshu`, Since: 1.6.0
  440. * @HB_SCRIPT_SOYOMBO: `Soyo`, Since: 1.6.0
  441. * @HB_SCRIPT_ZANABAZAR_SQUARE: `Zanb`, Since: 1.6.0
  442. * @HB_SCRIPT_DOGRA: `Dogr`, Since: 1.8.0
  443. * @HB_SCRIPT_GUNJALA_GONDI: `Gong`, Since: 1.8.0
  444. * @HB_SCRIPT_HANIFI_ROHINGYA: `Rohg`, Since: 1.8.0
  445. * @HB_SCRIPT_MAKASAR: `Maka`, Since: 1.8.0
  446. * @HB_SCRIPT_MEDEFAIDRIN: `Medf`, Since: 1.8.0
  447. * @HB_SCRIPT_OLD_SOGDIAN: `Sogo`, Since: 1.8.0
  448. * @HB_SCRIPT_SOGDIAN: `Sogd`, Since: 1.8.0
  449. * @HB_SCRIPT_ELYMAIC: `Elym`, Since: 2.4.0
  450. * @HB_SCRIPT_NANDINAGARI: `Nand`, Since: 2.4.0
  451. * @HB_SCRIPT_NYIAKENG_PUACHUE_HMONG: `Hmnp`, Since: 2.4.0
  452. * @HB_SCRIPT_WANCHO: `Wcho`, Since: 2.4.0
  453. * @HB_SCRIPT_CHORASMIAN: `Chrs`, Since: 2.6.7
  454. * @HB_SCRIPT_DIVES_AKURU: `Diak`, Since: 2.6.7
  455. * @HB_SCRIPT_KHITAN_SMALL_SCRIPT: `Kits`, Since: 2.6.7
  456. * @HB_SCRIPT_YEZIDI: `Yezi`, Since: 2.6.7
  457. * @HB_SCRIPT_CYPRO_MINOAN: `Cpmn`, Since: 3.0.0
  458. * @HB_SCRIPT_OLD_UYGHUR: `Ougr`, Since: 3.0.0
  459. * @HB_SCRIPT_TANGSA: `Tnsa`, Since: 3.0.0
  460. * @HB_SCRIPT_TOTO: `Toto`, Since: 3.0.0
  461. * @HB_SCRIPT_VITHKUQI: `Vith`, Since: 3.0.0
  462. * @HB_SCRIPT_MATH: `Zmth`, Since: 3.4.0
  463. * @HB_SCRIPT_KAWI: `Kawi`, Since: 5.2.0
  464. * @HB_SCRIPT_NAG_MUNDARI: `Nagm`, Since: 5.2.0
  465. * @HB_SCRIPT_INVALID: No script set
  466. *
  467. * Data type for scripts. Each #hb_script_t's value is an #hb_tag_t corresponding
  468. * to the four-letter values defined by [ISO 15924](https://unicode.org/iso15924/).
  469. *
  470. * See also the Script (sc) property of the Unicode Character Database.
  471. *
  472. **/
  473. /* https://docs.google.com/spreadsheets/d/1Y90M0Ie3MUJ6UVCRDOypOtijlMDLNNyyLk36T6iMu0o */
  474. typedef enum
  475. {
  476. HB_SCRIPT_COMMON = HB_TAG ('Z','y','y','y'), /*1.1*/
  477. HB_SCRIPT_INHERITED = HB_TAG ('Z','i','n','h'), /*1.1*/
  478. HB_SCRIPT_UNKNOWN = HB_TAG ('Z','z','z','z'), /*5.0*/
  479. HB_SCRIPT_ARABIC = HB_TAG ('A','r','a','b'), /*1.1*/
  480. HB_SCRIPT_ARMENIAN = HB_TAG ('A','r','m','n'), /*1.1*/
  481. HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'), /*1.1*/
  482. HB_SCRIPT_CYRILLIC = HB_TAG ('C','y','r','l'), /*1.1*/
  483. HB_SCRIPT_DEVANAGARI = HB_TAG ('D','e','v','a'), /*1.1*/
  484. HB_SCRIPT_GEORGIAN = HB_TAG ('G','e','o','r'), /*1.1*/
  485. HB_SCRIPT_GREEK = HB_TAG ('G','r','e','k'), /*1.1*/
  486. HB_SCRIPT_GUJARATI = HB_TAG ('G','u','j','r'), /*1.1*/
  487. HB_SCRIPT_GURMUKHI = HB_TAG ('G','u','r','u'), /*1.1*/
  488. HB_SCRIPT_HANGUL = HB_TAG ('H','a','n','g'), /*1.1*/
  489. HB_SCRIPT_HAN = HB_TAG ('H','a','n','i'), /*1.1*/
  490. HB_SCRIPT_HEBREW = HB_TAG ('H','e','b','r'), /*1.1*/
  491. HB_SCRIPT_HIRAGANA = HB_TAG ('H','i','r','a'), /*1.1*/
  492. HB_SCRIPT_KANNADA = HB_TAG ('K','n','d','a'), /*1.1*/
  493. HB_SCRIPT_KATAKANA = HB_TAG ('K','a','n','a'), /*1.1*/
  494. HB_SCRIPT_LAO = HB_TAG ('L','a','o','o'), /*1.1*/
  495. HB_SCRIPT_LATIN = HB_TAG ('L','a','t','n'), /*1.1*/
  496. HB_SCRIPT_MALAYALAM = HB_TAG ('M','l','y','m'), /*1.1*/
  497. HB_SCRIPT_ORIYA = HB_TAG ('O','r','y','a'), /*1.1*/
  498. HB_SCRIPT_TAMIL = HB_TAG ('T','a','m','l'), /*1.1*/
  499. HB_SCRIPT_TELUGU = HB_TAG ('T','e','l','u'), /*1.1*/
  500. HB_SCRIPT_THAI = HB_TAG ('T','h','a','i'), /*1.1*/
  501. HB_SCRIPT_TIBETAN = HB_TAG ('T','i','b','t'), /*2.0*/
  502. HB_SCRIPT_BOPOMOFO = HB_TAG ('B','o','p','o'), /*3.0*/
  503. HB_SCRIPT_BRAILLE = HB_TAG ('B','r','a','i'), /*3.0*/
  504. HB_SCRIPT_CANADIAN_SYLLABICS = HB_TAG ('C','a','n','s'), /*3.0*/
  505. HB_SCRIPT_CHEROKEE = HB_TAG ('C','h','e','r'), /*3.0*/
  506. HB_SCRIPT_ETHIOPIC = HB_TAG ('E','t','h','i'), /*3.0*/
  507. HB_SCRIPT_KHMER = HB_TAG ('K','h','m','r'), /*3.0*/
  508. HB_SCRIPT_MONGOLIAN = HB_TAG ('M','o','n','g'), /*3.0*/
  509. HB_SCRIPT_MYANMAR = HB_TAG ('M','y','m','r'), /*3.0*/
  510. HB_SCRIPT_OGHAM = HB_TAG ('O','g','a','m'), /*3.0*/
  511. HB_SCRIPT_RUNIC = HB_TAG ('R','u','n','r'), /*3.0*/
  512. HB_SCRIPT_SINHALA = HB_TAG ('S','i','n','h'), /*3.0*/
  513. HB_SCRIPT_SYRIAC = HB_TAG ('S','y','r','c'), /*3.0*/
  514. HB_SCRIPT_THAANA = HB_TAG ('T','h','a','a'), /*3.0*/
  515. HB_SCRIPT_YI = HB_TAG ('Y','i','i','i'), /*3.0*/
  516. HB_SCRIPT_DESERET = HB_TAG ('D','s','r','t'), /*3.1*/
  517. HB_SCRIPT_GOTHIC = HB_TAG ('G','o','t','h'), /*3.1*/
  518. HB_SCRIPT_OLD_ITALIC = HB_TAG ('I','t','a','l'), /*3.1*/
  519. HB_SCRIPT_BUHID = HB_TAG ('B','u','h','d'), /*3.2*/
  520. HB_SCRIPT_HANUNOO = HB_TAG ('H','a','n','o'), /*3.2*/
  521. HB_SCRIPT_TAGALOG = HB_TAG ('T','g','l','g'), /*3.2*/
  522. HB_SCRIPT_TAGBANWA = HB_TAG ('T','a','g','b'), /*3.2*/
  523. HB_SCRIPT_CYPRIOT = HB_TAG ('C','p','r','t'), /*4.0*/
  524. HB_SCRIPT_LIMBU = HB_TAG ('L','i','m','b'), /*4.0*/
  525. HB_SCRIPT_LINEAR_B = HB_TAG ('L','i','n','b'), /*4.0*/
  526. HB_SCRIPT_OSMANYA = HB_TAG ('O','s','m','a'), /*4.0*/
  527. HB_SCRIPT_SHAVIAN = HB_TAG ('S','h','a','w'), /*4.0*/
  528. HB_SCRIPT_TAI_LE = HB_TAG ('T','a','l','e'), /*4.0*/
  529. HB_SCRIPT_UGARITIC = HB_TAG ('U','g','a','r'), /*4.0*/
  530. HB_SCRIPT_BUGINESE = HB_TAG ('B','u','g','i'), /*4.1*/
  531. HB_SCRIPT_COPTIC = HB_TAG ('C','o','p','t'), /*4.1*/
  532. HB_SCRIPT_GLAGOLITIC = HB_TAG ('G','l','a','g'), /*4.1*/
  533. HB_SCRIPT_KHAROSHTHI = HB_TAG ('K','h','a','r'), /*4.1*/
  534. HB_SCRIPT_NEW_TAI_LUE = HB_TAG ('T','a','l','u'), /*4.1*/
  535. HB_SCRIPT_OLD_PERSIAN = HB_TAG ('X','p','e','o'), /*4.1*/
  536. HB_SCRIPT_SYLOTI_NAGRI = HB_TAG ('S','y','l','o'), /*4.1*/
  537. HB_SCRIPT_TIFINAGH = HB_TAG ('T','f','n','g'), /*4.1*/
  538. HB_SCRIPT_BALINESE = HB_TAG ('B','a','l','i'), /*5.0*/
  539. HB_SCRIPT_CUNEIFORM = HB_TAG ('X','s','u','x'), /*5.0*/
  540. HB_SCRIPT_NKO = HB_TAG ('N','k','o','o'), /*5.0*/
  541. HB_SCRIPT_PHAGS_PA = HB_TAG ('P','h','a','g'), /*5.0*/
  542. HB_SCRIPT_PHOENICIAN = HB_TAG ('P','h','n','x'), /*5.0*/
  543. HB_SCRIPT_CARIAN = HB_TAG ('C','a','r','i'), /*5.1*/
  544. HB_SCRIPT_CHAM = HB_TAG ('C','h','a','m'), /*5.1*/
  545. HB_SCRIPT_KAYAH_LI = HB_TAG ('K','a','l','i'), /*5.1*/
  546. HB_SCRIPT_LEPCHA = HB_TAG ('L','e','p','c'), /*5.1*/
  547. HB_SCRIPT_LYCIAN = HB_TAG ('L','y','c','i'), /*5.1*/
  548. HB_SCRIPT_LYDIAN = HB_TAG ('L','y','d','i'), /*5.1*/
  549. HB_SCRIPT_OL_CHIKI = HB_TAG ('O','l','c','k'), /*5.1*/
  550. HB_SCRIPT_REJANG = HB_TAG ('R','j','n','g'), /*5.1*/
  551. HB_SCRIPT_SAURASHTRA = HB_TAG ('S','a','u','r'), /*5.1*/
  552. HB_SCRIPT_SUNDANESE = HB_TAG ('S','u','n','d'), /*5.1*/
  553. HB_SCRIPT_VAI = HB_TAG ('V','a','i','i'), /*5.1*/
  554. HB_SCRIPT_AVESTAN = HB_TAG ('A','v','s','t'), /*5.2*/
  555. HB_SCRIPT_BAMUM = HB_TAG ('B','a','m','u'), /*5.2*/
  556. HB_SCRIPT_EGYPTIAN_HIEROGLYPHS = HB_TAG ('E','g','y','p'), /*5.2*/
  557. HB_SCRIPT_IMPERIAL_ARAMAIC = HB_TAG ('A','r','m','i'), /*5.2*/
  558. HB_SCRIPT_INSCRIPTIONAL_PAHLAVI = HB_TAG ('P','h','l','i'), /*5.2*/
  559. HB_SCRIPT_INSCRIPTIONAL_PARTHIAN = HB_TAG ('P','r','t','i'), /*5.2*/
  560. HB_SCRIPT_JAVANESE = HB_TAG ('J','a','v','a'), /*5.2*/
  561. HB_SCRIPT_KAITHI = HB_TAG ('K','t','h','i'), /*5.2*/
  562. HB_SCRIPT_LISU = HB_TAG ('L','i','s','u'), /*5.2*/
  563. HB_SCRIPT_MEETEI_MAYEK = HB_TAG ('M','t','e','i'), /*5.2*/
  564. HB_SCRIPT_OLD_SOUTH_ARABIAN = HB_TAG ('S','a','r','b'), /*5.2*/
  565. HB_SCRIPT_OLD_TURKIC = HB_TAG ('O','r','k','h'), /*5.2*/
  566. HB_SCRIPT_SAMARITAN = HB_TAG ('S','a','m','r'), /*5.2*/
  567. HB_SCRIPT_TAI_THAM = HB_TAG ('L','a','n','a'), /*5.2*/
  568. HB_SCRIPT_TAI_VIET = HB_TAG ('T','a','v','t'), /*5.2*/
  569. HB_SCRIPT_BATAK = HB_TAG ('B','a','t','k'), /*6.0*/
  570. HB_SCRIPT_BRAHMI = HB_TAG ('B','r','a','h'), /*6.0*/
  571. HB_SCRIPT_MANDAIC = HB_TAG ('M','a','n','d'), /*6.0*/
  572. HB_SCRIPT_CHAKMA = HB_TAG ('C','a','k','m'), /*6.1*/
  573. HB_SCRIPT_MEROITIC_CURSIVE = HB_TAG ('M','e','r','c'), /*6.1*/
  574. HB_SCRIPT_MEROITIC_HIEROGLYPHS = HB_TAG ('M','e','r','o'), /*6.1*/
  575. HB_SCRIPT_MIAO = HB_TAG ('P','l','r','d'), /*6.1*/
  576. HB_SCRIPT_SHARADA = HB_TAG ('S','h','r','d'), /*6.1*/
  577. HB_SCRIPT_SORA_SOMPENG = HB_TAG ('S','o','r','a'), /*6.1*/
  578. HB_SCRIPT_TAKRI = HB_TAG ('T','a','k','r'), /*6.1*/
  579. /*
  580. * Since: 0.9.30
  581. */
  582. HB_SCRIPT_BASSA_VAH = HB_TAG ('B','a','s','s'), /*7.0*/
  583. HB_SCRIPT_CAUCASIAN_ALBANIAN = HB_TAG ('A','g','h','b'), /*7.0*/
  584. HB_SCRIPT_DUPLOYAN = HB_TAG ('D','u','p','l'), /*7.0*/
  585. HB_SCRIPT_ELBASAN = HB_TAG ('E','l','b','a'), /*7.0*/
  586. HB_SCRIPT_GRANTHA = HB_TAG ('G','r','a','n'), /*7.0*/
  587. HB_SCRIPT_KHOJKI = HB_TAG ('K','h','o','j'), /*7.0*/
  588. HB_SCRIPT_KHUDAWADI = HB_TAG ('S','i','n','d'), /*7.0*/
  589. HB_SCRIPT_LINEAR_A = HB_TAG ('L','i','n','a'), /*7.0*/
  590. HB_SCRIPT_MAHAJANI = HB_TAG ('M','a','h','j'), /*7.0*/
  591. HB_SCRIPT_MANICHAEAN = HB_TAG ('M','a','n','i'), /*7.0*/
  592. HB_SCRIPT_MENDE_KIKAKUI = HB_TAG ('M','e','n','d'), /*7.0*/
  593. HB_SCRIPT_MODI = HB_TAG ('M','o','d','i'), /*7.0*/
  594. HB_SCRIPT_MRO = HB_TAG ('M','r','o','o'), /*7.0*/
  595. HB_SCRIPT_NABATAEAN = HB_TAG ('N','b','a','t'), /*7.0*/
  596. HB_SCRIPT_OLD_NORTH_ARABIAN = HB_TAG ('N','a','r','b'), /*7.0*/
  597. HB_SCRIPT_OLD_PERMIC = HB_TAG ('P','e','r','m'), /*7.0*/
  598. HB_SCRIPT_PAHAWH_HMONG = HB_TAG ('H','m','n','g'), /*7.0*/
  599. HB_SCRIPT_PALMYRENE = HB_TAG ('P','a','l','m'), /*7.0*/
  600. HB_SCRIPT_PAU_CIN_HAU = HB_TAG ('P','a','u','c'), /*7.0*/
  601. HB_SCRIPT_PSALTER_PAHLAVI = HB_TAG ('P','h','l','p'), /*7.0*/
  602. HB_SCRIPT_SIDDHAM = HB_TAG ('S','i','d','d'), /*7.0*/
  603. HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'), /*7.0*/
  604. HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'), /*7.0*/
  605. HB_SCRIPT_AHOM = HB_TAG ('A','h','o','m'), /*8.0*/
  606. HB_SCRIPT_ANATOLIAN_HIEROGLYPHS = HB_TAG ('H','l','u','w'), /*8.0*/
  607. HB_SCRIPT_HATRAN = HB_TAG ('H','a','t','r'), /*8.0*/
  608. HB_SCRIPT_MULTANI = HB_TAG ('M','u','l','t'), /*8.0*/
  609. HB_SCRIPT_OLD_HUNGARIAN = HB_TAG ('H','u','n','g'), /*8.0*/
  610. HB_SCRIPT_SIGNWRITING = HB_TAG ('S','g','n','w'), /*8.0*/
  611. /*
  612. * Since 1.3.0
  613. */
  614. HB_SCRIPT_ADLAM = HB_TAG ('A','d','l','m'), /*9.0*/
  615. HB_SCRIPT_BHAIKSUKI = HB_TAG ('B','h','k','s'), /*9.0*/
  616. HB_SCRIPT_MARCHEN = HB_TAG ('M','a','r','c'), /*9.0*/
  617. HB_SCRIPT_OSAGE = HB_TAG ('O','s','g','e'), /*9.0*/
  618. HB_SCRIPT_TANGUT = HB_TAG ('T','a','n','g'), /*9.0*/
  619. HB_SCRIPT_NEWA = HB_TAG ('N','e','w','a'), /*9.0*/
  620. /*
  621. * Since 1.6.0
  622. */
  623. HB_SCRIPT_MASARAM_GONDI = HB_TAG ('G','o','n','m'), /*10.0*/
  624. HB_SCRIPT_NUSHU = HB_TAG ('N','s','h','u'), /*10.0*/
  625. HB_SCRIPT_SOYOMBO = HB_TAG ('S','o','y','o'), /*10.0*/
  626. HB_SCRIPT_ZANABAZAR_SQUARE = HB_TAG ('Z','a','n','b'), /*10.0*/
  627. /*
  628. * Since 1.8.0
  629. */
  630. HB_SCRIPT_DOGRA = HB_TAG ('D','o','g','r'), /*11.0*/
  631. HB_SCRIPT_GUNJALA_GONDI = HB_TAG ('G','o','n','g'), /*11.0*/
  632. HB_SCRIPT_HANIFI_ROHINGYA = HB_TAG ('R','o','h','g'), /*11.0*/
  633. HB_SCRIPT_MAKASAR = HB_TAG ('M','a','k','a'), /*11.0*/
  634. HB_SCRIPT_MEDEFAIDRIN = HB_TAG ('M','e','d','f'), /*11.0*/
  635. HB_SCRIPT_OLD_SOGDIAN = HB_TAG ('S','o','g','o'), /*11.0*/
  636. HB_SCRIPT_SOGDIAN = HB_TAG ('S','o','g','d'), /*11.0*/
  637. /*
  638. * Since 2.4.0
  639. */
  640. HB_SCRIPT_ELYMAIC = HB_TAG ('E','l','y','m'), /*12.0*/
  641. HB_SCRIPT_NANDINAGARI = HB_TAG ('N','a','n','d'), /*12.0*/
  642. HB_SCRIPT_NYIAKENG_PUACHUE_HMONG = HB_TAG ('H','m','n','p'), /*12.0*/
  643. HB_SCRIPT_WANCHO = HB_TAG ('W','c','h','o'), /*12.0*/
  644. /*
  645. * Since 2.6.7
  646. */
  647. HB_SCRIPT_CHORASMIAN = HB_TAG ('C','h','r','s'), /*13.0*/
  648. HB_SCRIPT_DIVES_AKURU = HB_TAG ('D','i','a','k'), /*13.0*/
  649. HB_SCRIPT_KHITAN_SMALL_SCRIPT = HB_TAG ('K','i','t','s'), /*13.0*/
  650. HB_SCRIPT_YEZIDI = HB_TAG ('Y','e','z','i'), /*13.0*/
  651. /*
  652. * Since 3.0.0
  653. */
  654. HB_SCRIPT_CYPRO_MINOAN = HB_TAG ('C','p','m','n'), /*14.0*/
  655. HB_SCRIPT_OLD_UYGHUR = HB_TAG ('O','u','g','r'), /*14.0*/
  656. HB_SCRIPT_TANGSA = HB_TAG ('T','n','s','a'), /*14.0*/
  657. HB_SCRIPT_TOTO = HB_TAG ('T','o','t','o'), /*14.0*/
  658. HB_SCRIPT_VITHKUQI = HB_TAG ('V','i','t','h'), /*14.0*/
  659. /*
  660. * Since 3.4.0
  661. */
  662. HB_SCRIPT_MATH = HB_TAG ('Z','m','t','h'),
  663. /*
  664. * Since 5.2.0
  665. */
  666. HB_SCRIPT_KAWI = HB_TAG ('K','a','w','i'), /*15.0*/
  667. HB_SCRIPT_NAG_MUNDARI = HB_TAG ('N','a','g','m'), /*15.0*/
  668. /* No script set. */
  669. HB_SCRIPT_INVALID = HB_TAG_NONE,
  670. /*< private >*/
  671. /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
  672. * without risking undefined behavior. We have two, for historical reasons.
  673. * HB_TAG_MAX used to be unsigned, but that was invalid Ansi C, so was changed
  674. * to _HB_SCRIPT_MAX_VALUE to be equal to HB_TAG_MAX_SIGNED as well.
  675. *
  676. * See this thread for technicalities:
  677. *
  678. * https://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
  679. */
  680. _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX_SIGNED, /*< skip >*/
  681. _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/
  682. } hb_script_t;
  683. /* Script functions */
  684. HB_EXTERN hb_script_t
  685. hb_script_from_iso15924_tag (hb_tag_t tag);
  686. HB_EXTERN hb_script_t
  687. hb_script_from_string (const char *str, int len);
  688. HB_EXTERN hb_tag_t
  689. hb_script_to_iso15924_tag (hb_script_t script);
  690. HB_EXTERN hb_direction_t
  691. hb_script_get_horizontal_direction (hb_script_t script);
  692. /* User data */
  693. /**
  694. * hb_user_data_key_t:
  695. *
  696. * Data structure for holding user-data keys.
  697. *
  698. **/
  699. typedef struct hb_user_data_key_t {
  700. /*< private >*/
  701. char unused;
  702. } hb_user_data_key_t;
  703. /**
  704. * hb_destroy_func_t:
  705. * @user_data: the data to be destroyed
  706. *
  707. * A virtual method for destroy user-data callbacks.
  708. *
  709. */
  710. typedef void (*hb_destroy_func_t) (void *user_data);
  711. /* Font features and variations. */
  712. /**
  713. * HB_FEATURE_GLOBAL_START:
  714. *
  715. * Special setting for #hb_feature_t.start to apply the feature from the start
  716. * of the buffer.
  717. *
  718. * Since: 2.0.0
  719. */
  720. #define HB_FEATURE_GLOBAL_START 0
  721. /**
  722. * HB_FEATURE_GLOBAL_END:
  723. *
  724. * Special setting for #hb_feature_t.end to apply the feature from to the end
  725. * of the buffer.
  726. *
  727. * Since: 2.0.0
  728. */
  729. #define HB_FEATURE_GLOBAL_END ((unsigned int) -1)
  730. /**
  731. * hb_feature_t:
  732. * @tag: The #hb_tag_t tag of the feature
  733. * @value: The value of the feature. 0 disables the feature, non-zero (usually
  734. * 1) enables the feature. For features implemented as lookup type 3 (like
  735. * 'salt') the @value is a one based index into the alternates.
  736. * @start: the cluster to start applying this feature setting (inclusive).
  737. * @end: the cluster to end applying this feature setting (exclusive).
  738. *
  739. * The #hb_feature_t is the structure that holds information about requested
  740. * feature application. The feature will be applied with the given value to all
  741. * glyphs which are in clusters between @start (inclusive) and @end (exclusive).
  742. * Setting start to #HB_FEATURE_GLOBAL_START and end to #HB_FEATURE_GLOBAL_END
  743. * specifies that the feature always applies to the entire buffer.
  744. */
  745. typedef struct hb_feature_t {
  746. hb_tag_t tag;
  747. uint32_t value;
  748. unsigned int start;
  749. unsigned int end;
  750. } hb_feature_t;
  751. HB_EXTERN hb_bool_t
  752. hb_feature_from_string (const char *str, int len,
  753. hb_feature_t *feature);
  754. HB_EXTERN void
  755. hb_feature_to_string (hb_feature_t *feature,
  756. char *buf, unsigned int size);
  757. /**
  758. * hb_variation_t:
  759. * @tag: The #hb_tag_t tag of the variation-axis name
  760. * @value: The value of the variation axis
  761. *
  762. * Data type for holding variation data. Registered OpenType
  763. * variation-axis tags are listed in
  764. * [OpenType Axis Tag Registry](https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg).
  765. *
  766. * Since: 1.4.2
  767. */
  768. typedef struct hb_variation_t {
  769. hb_tag_t tag;
  770. float value;
  771. } hb_variation_t;
  772. HB_EXTERN hb_bool_t
  773. hb_variation_from_string (const char *str, int len,
  774. hb_variation_t *variation);
  775. HB_EXTERN void
  776. hb_variation_to_string (hb_variation_t *variation,
  777. char *buf, unsigned int size);
  778. /**
  779. * hb_color_t:
  780. *
  781. * Data type for holding color values. Colors are eight bits per
  782. * channel RGB plus alpha transparency.
  783. *
  784. * Since: 2.1.0
  785. */
  786. typedef uint32_t hb_color_t;
  787. /**
  788. * HB_COLOR:
  789. * @b: blue channel value
  790. * @g: green channel value
  791. * @r: red channel value
  792. * @a: alpha channel value
  793. *
  794. * Constructs an #hb_color_t from four integers.
  795. *
  796. * Since: 2.1.0
  797. */
  798. #define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a)))
  799. HB_EXTERN uint8_t
  800. hb_color_get_alpha (hb_color_t color);
  801. #define hb_color_get_alpha(color) ((color) & 0xFF)
  802. HB_EXTERN uint8_t
  803. hb_color_get_red (hb_color_t color);
  804. #define hb_color_get_red(color) (((color) >> 8) & 0xFF)
  805. HB_EXTERN uint8_t
  806. hb_color_get_green (hb_color_t color);
  807. #define hb_color_get_green(color) (((color) >> 16) & 0xFF)
  808. HB_EXTERN uint8_t
  809. hb_color_get_blue (hb_color_t color);
  810. #define hb_color_get_blue(color) (((color) >> 24) & 0xFF)
  811. HB_END_DECLS
  812. #endif /* HB_COMMON_H */