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
29#ifndef HB_H_IN
30#error "Include <hb.h> instead."
31#endif
32
33#ifndef HB_COMMON_H
34#define HB_COMMON_H
35
36#ifndef HB_EXTERN
37#define HB_EXTERN extern
38#endif
39
40#ifndef HB_BEGIN_DECLS
41# ifdef __cplusplus
42# define HB_BEGIN_DECLS extern "C" {
43# define HB_END_DECLS }
44# else /* !__cplusplus */
45# define HB_BEGIN_DECLS
46# define HB_END_DECLS
47# endif /* !__cplusplus */
48#endif
49
50#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
51 defined (_sgi) || defined (__sun) || defined (sun) || \
52 defined (__digital__) || defined (__HP_cc)
53# include <inttypes.h>
54#elif defined (_AIX)
55# include <sys/inttypes.h>
56#elif defined (_MSC_VER) && _MSC_VER < 1600
57/* VS 2010 (_MSC_VER 1600) has stdint.h */
58typedef __int8 int8_t;
59typedef unsigned __int8 uint8_t;
60typedef __int16 int16_t;
61typedef unsigned __int16 uint16_t;
62typedef __int32 int32_t;
63typedef unsigned __int32 uint32_t;
64typedef __int64 int64_t;
65typedef unsigned __int64 uint64_t;
66#elif defined (__KERNEL__)
67# include <linux/types.h>
68#else
69# include <stdint.h>
70#endif
71
72#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
73#define HB_DEPRECATED __attribute__((__deprecated__))
74#elif defined(_MSC_VER) && (_MSC_VER >= 1300)
75#define HB_DEPRECATED __declspec(deprecated)
76#else
77#define HB_DEPRECATED
78#endif
79
80#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
81#define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
82#elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
83#define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
84#else
85#define HB_DEPRECATED_FOR(f) HB_DEPRECATED
86#endif
87
88
89HB_BEGIN_DECLS
90
91/**
92 * hb_bool_t:
93 *
94 * Data type for booleans.
95 *
96 **/
97typedef int hb_bool_t;
98
99/**
100 * hb_codepoint_t:
101 *
102 * Data type for holding Unicode codepoints. Also
103 * used to hold glyph IDs.
104 *
105 **/
106typedef uint32_t hb_codepoint_t;
107/**
108 * hb_position_t:
109 *
110 * Data type for holding a single coordinate value.
111 * Contour points and other multi-dimensional data are
112 * stored as tuples of #hb_position_t's.
113 *
114 **/
115typedef int32_t hb_position_t;
116/**
117 * hb_mask_t:
118 *
119 * Data type for bitmasks.
120 *
121 **/
122typedef uint32_t hb_mask_t;
123
124typedef union _hb_var_int_t {
125 uint32_t u32;
126 int32_t i32;
127 uint16_t u16[2];
128 int16_t i16[2];
129 uint8_t u8[4];
130 int8_t i8[4];
131} hb_var_int_t;
132
133
134/* hb_tag_t */
135
136/**
137 * hb_tag_t:
138 *
139 * Data type for tag identifiers. Tags are four
140 * byte integers, each byte representing a character.
141 *
142 * Tags are used to identify tables, design-variation axes,
143 * scripts, languages, font features, and baselines with
144 * human-readable names.
145 *
146 **/
147typedef uint32_t hb_tag_t;
148
149/**
150 * HB_TAG:
151 *
152 * Constructs an #hb_tag_t from four characters.
153 *
154 **/
155#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)))
156
157/**
158 * HB_UNTAG:
159 *
160 * Extracts the characters from an #hb_tag_t.
161 *
162 **/
163#define HB_UNTAG(tag) (uint8_t)(((tag)>>24)&0xFF), (uint8_t)(((tag)>>16)&0xFF), (uint8_t)(((tag)>>8)&0xFF), (uint8_t)((tag)&0xFF)
164
165#define HB_TAG_NONE HB_TAG(0,0,0,0)
166#define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
167#define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
168
169/* len=-1 means str is NUL-terminated. */
170HB_EXTERN hb_tag_t
171hb_tag_from_string (const char *str, int len);
172
173/* buf should have 4 bytes. */
174HB_EXTERN void
175hb_tag_to_string (hb_tag_t tag, char *buf);
176
177
178/**
179 * hb_direction_t:
180 * @HB_DIRECTION_INVALID: Initial, unset direction.
181 * @HB_DIRECTION_LTR: Text is set horizontally from left to right.
182 * @HB_DIRECTION_RTL: Text is set horizontally from right to left.
183 * @HB_DIRECTION_TTB: Text is set vertically from top to bottom.
184 * @HB_DIRECTION_BTT: Text is set vertically from bottom to top.
185 *
186 * The direction of a text segment or buffer.
187 *
188 * A segment can also be tested for horizontal or vertical
189 * orientation (irrespective of specific direction) with
190 * HB_DIRECTION_IS_HORIZONTAL() or HB_DIRECTION_IS_VERTICAL().
191 *
192 */
193typedef enum {
194 HB_DIRECTION_INVALID = 0,
195 HB_DIRECTION_LTR = 4,
196 HB_DIRECTION_RTL,
197 HB_DIRECTION_TTB,
198 HB_DIRECTION_BTT
199} hb_direction_t;
200
201/* len=-1 means str is NUL-terminated */
202HB_EXTERN hb_direction_t
203hb_direction_from_string (const char *str, int len);
204
205HB_EXTERN const char *
206hb_direction_to_string (hb_direction_t direction);
207
208/**
209 * HB_DIRECTION_IS_VALID:
210 * @dir: #hb_direction_t to test
211 *
212 * Tests whether a text direction is valid.
213 *
214 **/
215#define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
216/* Direction must be valid for the following */
217/**
218 * HB_DIRECTION_IS_HORIZONTAL:
219 * @dir: #hb_direction_t to test
220 *
221 * Tests whether a text direction is horizontal. Requires
222 * that the direction be valid.
223 *
224 **/
225#define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
226/**
227 * HB_DIRECTION_IS_VERTICAL:
228 * @dir: #hb_direction_t to test
229 *
230 * Tests whether a text direction is vertical. Requires
231 * that the direction be valid.
232 *
233 **/
234#define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
235/**
236 * HB_DIRECTION_IS_FORWARD:
237 * @dir: #hb_direction_t to test
238 *
239 * Tests whether a text direction moves forward (from left to right, or from
240 * top to bottom). Requires that the direction be valid.
241 *
242 **/
243#define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
244/**
245 * HB_DIRECTION_IS_BACKWARD:
246 * @dir: #hb_direction_t to test
247 *
248 * Tests whether a text direction moves backward (from right to left, or from
249 * bottom to top). Requires that the direction be valid.
250 *
251 **/
252#define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
253/**
254 * HB_DIRECTION_REVERSE:
255 * @dir: #hb_direction_t to reverse
256 *
257 * Reverses a text direction. Requires that the direction
258 * be valid.
259 *
260 **/
261#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1))
262
263
264/* hb_language_t */
265
266typedef const struct hb_language_impl_t *hb_language_t;
267
268HB_EXTERN hb_language_t
269hb_language_from_string (const char *str, int len);
270
271HB_EXTERN const char *
272hb_language_to_string (hb_language_t language);
273
274#define HB_LANGUAGE_INVALID ((hb_language_t) 0)
275
276HB_EXTERN hb_language_t
277hb_language_get_default (void);
278
279
280/**
281 * hb_script_t:
282 * @HB_SCRIPT_COMMON: HB_TAG ('Z','y','y','y')
283 * @HB_SCRIPT_INHERITED: HB_TAG ('Z','i','n','h')
284 * @HB_SCRIPT_UNKNOWN: HB_TAG ('Z','z','z','z')
285 * @HB_SCRIPT_ARABIC
286 * @HB_SCRIPT_ARMENIAN
287 * @HB_SCRIPT_BENGALI
288 * @HB_SCRIPT_CYRILLIC
289 * @HB_SCRIPT_DEVANAGARI
290 * @HB_SCRIPT_GEORGIAN
291 * @HB_SCRIPT_GREEK
292 * @HB_SCRIPT_GUJARATI
293 * @HB_SCRIPT_GURMUKHI
294 * @HB_SCRIPT_HANGUL
295 * @HB_SCRIPT_HAN
296 * @HB_SCRIPT_HEBREW
297 * @HB_SCRIPT_HIRAGANA
298 * @HB_SCRIPT_KANNADA
299 * @HB_SCRIPT_KATAKANA
300 * @HB_SCRIPT_LAO
301 * @HB_SCRIPT_LATIN
302 * @HB_SCRIPT_MALAYALAM
303 * @HB_SCRIPT_ORIYA
304 * @HB_SCRIPT_TAMIL
305 * @HB_SCRIPT_TELUGU
306 * @HB_SCRIPT_THAI
307 * @HB_SCRIPT_TIBETAN
308 * @HB_SCRIPT_BOPOMOFO
309 * @HB_SCRIPT_BRAILLE
310 * @HB_SCRIPT_CANADIAN_SYLLABICS
311 * @HB_SCRIPT_CHEROKEE
312 * @HB_SCRIPT_ETHIOPIC
313 * @HB_SCRIPT_KHMER
314 * @HB_SCRIPT_MONGOLIAN
315 * @HB_SCRIPT_MYANMAR
316 * @HB_SCRIPT_OGHAM
317 * @HB_SCRIPT_RUNIC
318 * @HB_SCRIPT_SINHALA
319 * @HB_SCRIPT_SYRIAC
320 * @HB_SCRIPT_THAANA
321 * @HB_SCRIPT_YI
322 * @HB_SCRIPT_DESERET
323 * @HB_SCRIPT_GOTHIC
324 * @HB_SCRIPT_OLD_ITALIC
325 * @HB_SCRIPT_BUHID
326 * @HB_SCRIPT_HANUNOO
327 * @HB_SCRIPT_TAGALOG
328 * @HB_SCRIPT_TAGBANWA
329 * @HB_SCRIPT_CYPRIOT
330 * @HB_SCRIPT_LIMBU
331 * @HB_SCRIPT_LINEAR_B
332 * @HB_SCRIPT_OSMANYA
333 * @HB_SCRIPT_SHAVIAN
334 * @HB_SCRIPT_TAI_LE
335 * @HB_SCRIPT_UGARITIC
336 * @HB_SCRIPT_BUGINESE
337 * @HB_SCRIPT_COPTIC
338 * @HB_SCRIPT_GLAGOLITIC
339 * @HB_SCRIPT_KHAROSHTHI
340 * @HB_SCRIPT_NEW_TAI_LUE
341 * @HB_SCRIPT_OLD_PERSIAN
342 * @HB_SCRIPT_SYLOTI_NAGRI
343 * @HB_SCRIPT_TIFINAGH
344 * @HB_SCRIPT_BALINESE
345 * @HB_SCRIPT_CUNEIFORM
346 * @HB_SCRIPT_NKO
347 * @HB_SCRIPT_PHAGS_PA
348 * @HB_SCRIPT_PHOENICIAN
349 * @HB_SCRIPT_CARIAN
350 * @HB_SCRIPT_CHAM
351 * @HB_SCRIPT_KAYAH_LI
352 * @HB_SCRIPT_LEPCHA
353 * @HB_SCRIPT_LYCIAN
354 * @HB_SCRIPT_LYDIAN
355 * @HB_SCRIPT_OL_CHIKI
356 * @HB_SCRIPT_REJANG
357 * @HB_SCRIPT_SAURASHTRA
358 * @HB_SCRIPT_SUNDANESE
359 * @HB_SCRIPT_VAI
360 * @HB_SCRIPT_AVESTAN
361 * @HB_SCRIPT_BAMUM
362 * @HB_SCRIPT_EGYPTIAN_HIEROGLYPHS
363 * @HB_SCRIPT_IMPERIAL_ARAMAIC
364 * @HB_SCRIPT_INSCRIPTIONAL_PAHLAVI
365 * @HB_SCRIPT_INSCRIPTIONAL_PARTHIAN
366 * @HB_SCRIPT_JAVANESE
367 * @HB_SCRIPT_KAITHI
368 * @HB_SCRIPT_LISU
369 * @HB_SCRIPT_MEETEI_MAYEK
370 * @HB_SCRIPT_OLD_SOUTH_ARABIAN
371 * @HB_SCRIPT_OLD_TURKIC
372 * @HB_SCRIPT_SAMARITAN
373 * @HB_SCRIPT_TAI_THAM
374 * @HB_SCRIPT_TAI_VIET
375 * @HB_SCRIPT_BATAK
376 * @HB_SCRIPT_BRAHMI
377 * @HB_SCRIPT_MANDAIC
378 * @HB_SCRIPT_CHAKMA
379 * @HB_SCRIPT_MEROITIC_CURSIVE
380 * @HB_SCRIPT_MEROITIC_HIEROGLYPHS
381 * @HB_SCRIPT_MIAO
382 * @HB_SCRIPT_SHARADA
383 * @HB_SCRIPT_SORA_SOMPENG
384 * @HB_SCRIPT_TAKRI
385 * @HB_SCRIPT_BASSA_VAH
386 * @HB_SCRIPT_CAUCASIAN_ALBANIAN
387 * @HB_SCRIPT_DUPLOYAN
388 * @HB_SCRIPT_ELBASAN
389 * @HB_SCRIPT_GRANTHA
390 * @HB_SCRIPT_KHOJKI
391 * @HB_SCRIPT_KHUDAWADI
392 * @HB_SCRIPT_LINEAR_A
393 * @HB_SCRIPT_MAHAJANI
394 * @HB_SCRIPT_MANICHAEAN
395 * @HB_SCRIPT_MENDE_KIKAKUI
396 * @HB_SCRIPT_MODI
397 * @HB_SCRIPT_MRO
398 * @HB_SCRIPT_NABATAEAN
399 * @HB_SCRIPT_OLD_NORTH_ARABIAN
400 * @HB_SCRIPT_OLD_PERMIC
401 * @HB_SCRIPT_PAHAWH_HMONG
402 * @HB_SCRIPT_PALMYRENE
403 * @HB_SCRIPT_PAU_CIN_HAU
404 * @HB_SCRIPT_PSALTER_PAHLAVI
405 * @HB_SCRIPT_SIDDHAM
406 * @HB_SCRIPT_TIRHUTA
407 * @HB_SCRIPT_WARANG_CITI
408 * @HB_SCRIPT_AHOM
409 * @HB_SCRIPT_ANATOLIAN_HIEROGLYPHS
410 * @HB_SCRIPT_HATRAN
411 * @HB_SCRIPT_MULTANI
412 * @HB_SCRIPT_OLD_HUNGARIAN
413 * @HB_SCRIPT_SIGNWRITING
414 * @HB_SCRIPT_ADLAM
415 * @HB_SCRIPT_BHAIKSUKI
416 * @HB_SCRIPT_MARCHEN
417 * @HB_SCRIPT_OSAGE
418 * @HB_SCRIPT_TANGUT
419 * @HB_SCRIPT_NEWA
420 * @HB_SCRIPT_MASARAM_GONDI
421 * @HB_SCRIPT_NUSHU
422 * @HB_SCRIPT_SOYOMBO
423 * @HB_SCRIPT_ZANABAZAR_SQUARE
424 * @HB_SCRIPT_DOGRA
425 * @HB_SCRIPT_GUNJALA_GONDI
426 * @HB_SCRIPT_HANIFI_ROHINGYA
427 * @HB_SCRIPT_MAKASAR
428 * @HB_SCRIPT_MEDEFAIDRIN
429 * @HB_SCRIPT_OLD_SOGDIAN
430 * @HB_SCRIPT_SOGDIAN
431 * @HB_SCRIPT_ELYMAIC
432 * @HB_SCRIPT_NANDINAGARI
433 * @HB_SCRIPT_NYIAKENG_PUACHUE_HMONG
434 * @HB_SCRIPT_WANCHO
435 * @HB_SCRIPT_INVALID: #HB_TAG_NONE
436 *
437 * Data type for scripts. Each #hb_script_t's value is an #hb_tag_t corresponding
438 * to the four-letter values defined by [ISO 15924](https://unicode.org/iso15924/).
439 *
440 * See also the Script (sc) property of the Unicode Character Database.
441 *
442 **/
443
444/* https://unicode.org/iso15924/ */
445/* https://docs.google.com/spreadsheets/d/1Y90M0Ie3MUJ6UVCRDOypOtijlMDLNNyyLk36T6iMu0o */
446/* Unicode Character Database property: Script (sc) */
447typedef enum
448{
449 /*1.1*/ HB_SCRIPT_COMMON = HB_TAG ('Z','y','y','y'),
450 /*1.1*/ HB_SCRIPT_INHERITED = HB_TAG ('Z','i','n','h'),
451 /*5.0*/ HB_SCRIPT_UNKNOWN = HB_TAG ('Z','z','z','z'),
452
453 /*1.1*/ HB_SCRIPT_ARABIC = HB_TAG ('A','r','a','b'),
454 /*1.1*/ HB_SCRIPT_ARMENIAN = HB_TAG ('A','r','m','n'),
455 /*1.1*/ HB_SCRIPT_BENGALI = HB_TAG ('B','e','n','g'),
456 /*1.1*/ HB_SCRIPT_CYRILLIC = HB_TAG ('C','y','r','l'),
457 /*1.1*/ HB_SCRIPT_DEVANAGARI = HB_TAG ('D','e','v','a'),
458 /*1.1*/ HB_SCRIPT_GEORGIAN = HB_TAG ('G','e','o','r'),
459 /*1.1*/ HB_SCRIPT_GREEK = HB_TAG ('G','r','e','k'),
460 /*1.1*/ HB_SCRIPT_GUJARATI = HB_TAG ('G','u','j','r'),
461 /*1.1*/ HB_SCRIPT_GURMUKHI = HB_TAG ('G','u','r','u'),
462 /*1.1*/ HB_SCRIPT_HANGUL = HB_TAG ('H','a','n','g'),
463 /*1.1*/ HB_SCRIPT_HAN = HB_TAG ('H','a','n','i'),
464 /*1.1*/ HB_SCRIPT_HEBREW = HB_TAG ('H','e','b','r'),
465 /*1.1*/ HB_SCRIPT_HIRAGANA = HB_TAG ('H','i','r','a'),
466 /*1.1*/ HB_SCRIPT_KANNADA = HB_TAG ('K','n','d','a'),
467 /*1.1*/ HB_SCRIPT_KATAKANA = HB_TAG ('K','a','n','a'),
468 /*1.1*/ HB_SCRIPT_LAO = HB_TAG ('L','a','o','o'),
469 /*1.1*/ HB_SCRIPT_LATIN = HB_TAG ('L','a','t','n'),
470 /*1.1*/ HB_SCRIPT_MALAYALAM = HB_TAG ('M','l','y','m'),
471 /*1.1*/ HB_SCRIPT_ORIYA = HB_TAG ('O','r','y','a'),
472 /*1.1*/ HB_SCRIPT_TAMIL = HB_TAG ('T','a','m','l'),
473 /*1.1*/ HB_SCRIPT_TELUGU = HB_TAG ('T','e','l','u'),
474 /*1.1*/ HB_SCRIPT_THAI = HB_TAG ('T','h','a','i'),
475
476 /*2.0*/ HB_SCRIPT_TIBETAN = HB_TAG ('T','i','b','t'),
477
478 /*3.0*/ HB_SCRIPT_BOPOMOFO = HB_TAG ('B','o','p','o'),
479 /*3.0*/ HB_SCRIPT_BRAILLE = HB_TAG ('B','r','a','i'),
480 /*3.0*/ HB_SCRIPT_CANADIAN_SYLLABICS = HB_TAG ('C','a','n','s'),
481 /*3.0*/ HB_SCRIPT_CHEROKEE = HB_TAG ('C','h','e','r'),
482 /*3.0*/ HB_SCRIPT_ETHIOPIC = HB_TAG ('E','t','h','i'),
483 /*3.0*/ HB_SCRIPT_KHMER = HB_TAG ('K','h','m','r'),
484 /*3.0*/ HB_SCRIPT_MONGOLIAN = HB_TAG ('M','o','n','g'),
485 /*3.0*/ HB_SCRIPT_MYANMAR = HB_TAG ('M','y','m','r'),
486 /*3.0*/ HB_SCRIPT_OGHAM = HB_TAG ('O','g','a','m'),
487 /*3.0*/ HB_SCRIPT_RUNIC = HB_TAG ('R','u','n','r'),
488 /*3.0*/ HB_SCRIPT_SINHALA = HB_TAG ('S','i','n','h'),
489 /*3.0*/ HB_SCRIPT_SYRIAC = HB_TAG ('S','y','r','c'),
490 /*3.0*/ HB_SCRIPT_THAANA = HB_TAG ('T','h','a','a'),
491 /*3.0*/ HB_SCRIPT_YI = HB_TAG ('Y','i','i','i'),
492
493 /*3.1*/ HB_SCRIPT_DESERET = HB_TAG ('D','s','r','t'),
494 /*3.1*/ HB_SCRIPT_GOTHIC = HB_TAG ('G','o','t','h'),
495 /*3.1*/ HB_SCRIPT_OLD_ITALIC = HB_TAG ('I','t','a','l'),
496
497 /*3.2*/ HB_SCRIPT_BUHID = HB_TAG ('B','u','h','d'),
498 /*3.2*/ HB_SCRIPT_HANUNOO = HB_TAG ('H','a','n','o'),
499 /*3.2*/ HB_SCRIPT_TAGALOG = HB_TAG ('T','g','l','g'),
500 /*3.2*/ HB_SCRIPT_TAGBANWA = HB_TAG ('T','a','g','b'),
501
502 /*4.0*/ HB_SCRIPT_CYPRIOT = HB_TAG ('C','p','r','t'),
503 /*4.0*/ HB_SCRIPT_LIMBU = HB_TAG ('L','i','m','b'),
504 /*4.0*/ HB_SCRIPT_LINEAR_B = HB_TAG ('L','i','n','b'),
505 /*4.0*/ HB_SCRIPT_OSMANYA = HB_TAG ('O','s','m','a'),
506 /*4.0*/ HB_SCRIPT_SHAVIAN = HB_TAG ('S','h','a','w'),
507 /*4.0*/ HB_SCRIPT_TAI_LE = HB_TAG ('T','a','l','e'),
508 /*4.0*/ HB_SCRIPT_UGARITIC = HB_TAG ('U','g','a','r'),
509
510 /*4.1*/ HB_SCRIPT_BUGINESE = HB_TAG ('B','u','g','i'),
511 /*4.1*/ HB_SCRIPT_COPTIC = HB_TAG ('C','o','p','t'),
512 /*4.1*/ HB_SCRIPT_GLAGOLITIC = HB_TAG ('G','l','a','g'),
513 /*4.1*/ HB_SCRIPT_KHAROSHTHI = HB_TAG ('K','h','a','r'),
514 /*4.1*/ HB_SCRIPT_NEW_TAI_LUE = HB_TAG ('T','a','l','u'),
515 /*4.1*/ HB_SCRIPT_OLD_PERSIAN = HB_TAG ('X','p','e','o'),
516 /*4.1*/ HB_SCRIPT_SYLOTI_NAGRI = HB_TAG ('S','y','l','o'),
517 /*4.1*/ HB_SCRIPT_TIFINAGH = HB_TAG ('T','f','n','g'),
518
519 /*5.0*/ HB_SCRIPT_BALINESE = HB_TAG ('B','a','l','i'),
520 /*5.0*/ HB_SCRIPT_CUNEIFORM = HB_TAG ('X','s','u','x'),
521 /*5.0*/ HB_SCRIPT_NKO = HB_TAG ('N','k','o','o'),
522 /*5.0*/ HB_SCRIPT_PHAGS_PA = HB_TAG ('P','h','a','g'),
523 /*5.0*/ HB_SCRIPT_PHOENICIAN = HB_TAG ('P','h','n','x'),
524
525 /*5.1*/ HB_SCRIPT_CARIAN = HB_TAG ('C','a','r','i'),
526 /*5.1*/ HB_SCRIPT_CHAM = HB_TAG ('C','h','a','m'),
527 /*5.1*/ HB_SCRIPT_KAYAH_LI = HB_TAG ('K','a','l','i'),
528 /*5.1*/ HB_SCRIPT_LEPCHA = HB_TAG ('L','e','p','c'),
529 /*5.1*/ HB_SCRIPT_LYCIAN = HB_TAG ('L','y','c','i'),
530 /*5.1*/ HB_SCRIPT_LYDIAN = HB_TAG ('L','y','d','i'),
531 /*5.1*/ HB_SCRIPT_OL_CHIKI = HB_TAG ('O','l','c','k'),
532 /*5.1*/ HB_SCRIPT_REJANG = HB_TAG ('R','j','n','g'),
533 /*5.1*/ HB_SCRIPT_SAURASHTRA = HB_TAG ('S','a','u','r'),
534 /*5.1*/ HB_SCRIPT_SUNDANESE = HB_TAG ('S','u','n','d'),
535 /*5.1*/ HB_SCRIPT_VAI = HB_TAG ('V','a','i','i'),
536
537 /*5.2*/ HB_SCRIPT_AVESTAN = HB_TAG ('A','v','s','t'),
538 /*5.2*/ HB_SCRIPT_BAMUM = HB_TAG ('B','a','m','u'),
539 /*5.2*/ HB_SCRIPT_EGYPTIAN_HIEROGLYPHS = HB_TAG ('E','g','y','p'),
540 /*5.2*/ HB_SCRIPT_IMPERIAL_ARAMAIC = HB_TAG ('A','r','m','i'),
541 /*5.2*/ HB_SCRIPT_INSCRIPTIONAL_PAHLAVI = HB_TAG ('P','h','l','i'),
542 /*5.2*/ HB_SCRIPT_INSCRIPTIONAL_PARTHIAN = HB_TAG ('P','r','t','i'),
543 /*5.2*/ HB_SCRIPT_JAVANESE = HB_TAG ('J','a','v','a'),
544 /*5.2*/ HB_SCRIPT_KAITHI = HB_TAG ('K','t','h','i'),
545 /*5.2*/ HB_SCRIPT_LISU = HB_TAG ('L','i','s','u'),
546 /*5.2*/ HB_SCRIPT_MEETEI_MAYEK = HB_TAG ('M','t','e','i'),
547 /*5.2*/ HB_SCRIPT_OLD_SOUTH_ARABIAN = HB_TAG ('S','a','r','b'),
548 /*5.2*/ HB_SCRIPT_OLD_TURKIC = HB_TAG ('O','r','k','h'),
549 /*5.2*/ HB_SCRIPT_SAMARITAN = HB_TAG ('S','a','m','r'),
550 /*5.2*/ HB_SCRIPT_TAI_THAM = HB_TAG ('L','a','n','a'),
551 /*5.2*/ HB_SCRIPT_TAI_VIET = HB_TAG ('T','a','v','t'),
552
553 /*6.0*/ HB_SCRIPT_BATAK = HB_TAG ('B','a','t','k'),
554 /*6.0*/ HB_SCRIPT_BRAHMI = HB_TAG ('B','r','a','h'),
555 /*6.0*/ HB_SCRIPT_MANDAIC = HB_TAG ('M','a','n','d'),
556
557 /*6.1*/ HB_SCRIPT_CHAKMA = HB_TAG ('C','a','k','m'),
558 /*6.1*/ HB_SCRIPT_MEROITIC_CURSIVE = HB_TAG ('M','e','r','c'),
559 /*6.1*/ HB_SCRIPT_MEROITIC_HIEROGLYPHS = HB_TAG ('M','e','r','o'),
560 /*6.1*/ HB_SCRIPT_MIAO = HB_TAG ('P','l','r','d'),
561 /*6.1*/ HB_SCRIPT_SHARADA = HB_TAG ('S','h','r','d'),
562 /*6.1*/ HB_SCRIPT_SORA_SOMPENG = HB_TAG ('S','o','r','a'),
563 /*6.1*/ HB_SCRIPT_TAKRI = HB_TAG ('T','a','k','r'),
564
565 /*
566 * Since: 0.9.30
567 */
568 /*7.0*/ HB_SCRIPT_BASSA_VAH = HB_TAG ('B','a','s','s'),
569 /*7.0*/ HB_SCRIPT_CAUCASIAN_ALBANIAN = HB_TAG ('A','g','h','b'),
570 /*7.0*/ HB_SCRIPT_DUPLOYAN = HB_TAG ('D','u','p','l'),
571 /*7.0*/ HB_SCRIPT_ELBASAN = HB_TAG ('E','l','b','a'),
572 /*7.0*/ HB_SCRIPT_GRANTHA = HB_TAG ('G','r','a','n'),
573 /*7.0*/ HB_SCRIPT_KHOJKI = HB_TAG ('K','h','o','j'),
574 /*7.0*/ HB_SCRIPT_KHUDAWADI = HB_TAG ('S','i','n','d'),
575 /*7.0*/ HB_SCRIPT_LINEAR_A = HB_TAG ('L','i','n','a'),
576 /*7.0*/ HB_SCRIPT_MAHAJANI = HB_TAG ('M','a','h','j'),
577 /*7.0*/ HB_SCRIPT_MANICHAEAN = HB_TAG ('M','a','n','i'),
578 /*7.0*/ HB_SCRIPT_MENDE_KIKAKUI = HB_TAG ('M','e','n','d'),
579 /*7.0*/ HB_SCRIPT_MODI = HB_TAG ('M','o','d','i'),
580 /*7.0*/ HB_SCRIPT_MRO = HB_TAG ('M','r','o','o'),
581 /*7.0*/ HB_SCRIPT_NABATAEAN = HB_TAG ('N','b','a','t'),
582 /*7.0*/ HB_SCRIPT_OLD_NORTH_ARABIAN = HB_TAG ('N','a','r','b'),
583 /*7.0*/ HB_SCRIPT_OLD_PERMIC = HB_TAG ('P','e','r','m'),
584 /*7.0*/ HB_SCRIPT_PAHAWH_HMONG = HB_TAG ('H','m','n','g'),
585 /*7.0*/ HB_SCRIPT_PALMYRENE = HB_TAG ('P','a','l','m'),
586 /*7.0*/ HB_SCRIPT_PAU_CIN_HAU = HB_TAG ('P','a','u','c'),
587 /*7.0*/ HB_SCRIPT_PSALTER_PAHLAVI = HB_TAG ('P','h','l','p'),
588 /*7.0*/ HB_SCRIPT_SIDDHAM = HB_TAG ('S','i','d','d'),
589 /*7.0*/ HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'),
590 /*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
591
592 /*8.0*/ HB_SCRIPT_AHOM = HB_TAG ('A','h','o','m'),
593 /*8.0*/ HB_SCRIPT_ANATOLIAN_HIEROGLYPHS = HB_TAG ('H','l','u','w'),
594 /*8.0*/ HB_SCRIPT_HATRAN = HB_TAG ('H','a','t','r'),
595 /*8.0*/ HB_SCRIPT_MULTANI = HB_TAG ('M','u','l','t'),
596 /*8.0*/ HB_SCRIPT_OLD_HUNGARIAN = HB_TAG ('H','u','n','g'),
597 /*8.0*/ HB_SCRIPT_SIGNWRITING = HB_TAG ('S','g','n','w'),
598
599 /*
600 * Since 1.3.0
601 */
602 /*9.0*/ HB_SCRIPT_ADLAM = HB_TAG ('A','d','l','m'),
603 /*9.0*/ HB_SCRIPT_BHAIKSUKI = HB_TAG ('B','h','k','s'),
604 /*9.0*/ HB_SCRIPT_MARCHEN = HB_TAG ('M','a','r','c'),
605 /*9.0*/ HB_SCRIPT_OSAGE = HB_TAG ('O','s','g','e'),
606 /*9.0*/ HB_SCRIPT_TANGUT = HB_TAG ('T','a','n','g'),
607 /*9.0*/ HB_SCRIPT_NEWA = HB_TAG ('N','e','w','a'),
608
609 /*
610 * Since 1.6.0
611 */
612 /*10.0*/HB_SCRIPT_MASARAM_GONDI = HB_TAG ('G','o','n','m'),
613 /*10.0*/HB_SCRIPT_NUSHU = HB_TAG ('N','s','h','u'),
614 /*10.0*/HB_SCRIPT_SOYOMBO = HB_TAG ('S','o','y','o'),
615 /*10.0*/HB_SCRIPT_ZANABAZAR_SQUARE = HB_TAG ('Z','a','n','b'),
616
617 /*
618 * Since 1.8.0
619 */
620 /*11.0*/HB_SCRIPT_DOGRA = HB_TAG ('D','o','g','r'),
621 /*11.0*/HB_SCRIPT_GUNJALA_GONDI = HB_TAG ('G','o','n','g'),
622 /*11.0*/HB_SCRIPT_HANIFI_ROHINGYA = HB_TAG ('R','o','h','g'),
623 /*11.0*/HB_SCRIPT_MAKASAR = HB_TAG ('M','a','k','a'),
624 /*11.0*/HB_SCRIPT_MEDEFAIDRIN = HB_TAG ('M','e','d','f'),
625 /*11.0*/HB_SCRIPT_OLD_SOGDIAN = HB_TAG ('S','o','g','o'),
626 /*11.0*/HB_SCRIPT_SOGDIAN = HB_TAG ('S','o','g','d'),
627
628 /*
629 * Since 2.4.0
630 */
631 /*12.0*/HB_SCRIPT_ELYMAIC = HB_TAG ('E','l','y','m'),
632 /*12.0*/HB_SCRIPT_NANDINAGARI = HB_TAG ('N','a','n','d'),
633 /*12.0*/HB_SCRIPT_NYIAKENG_PUACHUE_HMONG = HB_TAG ('H','m','n','p'),
634 /*12.0*/HB_SCRIPT_WANCHO = HB_TAG ('W','c','h','o'),
635
636 /*
637 * Since 2.6.7
638 */
639 /*13.0*/HB_SCRIPT_CHORASMIAN = HB_TAG ('C','h','r','s'),
640 /*13.0*/HB_SCRIPT_DIVES_AKURU = HB_TAG ('D','i','a','k'),
641 /*13.0*/HB_SCRIPT_KHITAN_SMALL_SCRIPT = HB_TAG ('K','i','t','s'),
642 /*13.0*/HB_SCRIPT_YEZIDI = HB_TAG ('Y','e','z','i'),
643
644 /* No script set. */
645 HB_SCRIPT_INVALID = HB_TAG_NONE,
646
647 /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script_t
648 * without risking undefined behavior. We have two, for historical reasons.
649 * HB_TAG_MAX used to be unsigned, but that was invalid Ansi C, so was changed
650 * to _HB_SCRIPT_MAX_VALUE to be equal to HB_TAG_MAX_SIGNED as well.
651 *
652 * See this thread for technicalities:
653 *
654 * https://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
655 */
656 _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX_SIGNED, /*< skip >*/
657 _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/
658
659} hb_script_t;
660
661
662/* Script functions */
663
664HB_EXTERN hb_script_t
665hb_script_from_iso15924_tag (hb_tag_t tag);
666
667HB_EXTERN hb_script_t
668hb_script_from_string (const char *str, int len);
669
670HB_EXTERN hb_tag_t
671hb_script_to_iso15924_tag (hb_script_t script);
672
673HB_EXTERN hb_direction_t
674hb_script_get_horizontal_direction (hb_script_t script);
675
676
677/* User data */
678
679/**
680 * hb_user_data_key_t:
681 *
682 * Data structure for holding user-data keys.
683 *
684 **/
685typedef struct hb_user_data_key_t {
686 /*< private >*/
687 char unused;
688} hb_user_data_key_t;
689
690typedef void (*hb_destroy_func_t) (void *user_data);
691
692
693/* Font features and variations. */
694
695/**
696 * HB_FEATURE_GLOBAL_START
697 *
698 * Since: 2.0.0
699 */
700#define HB_FEATURE_GLOBAL_START 0
701/**
702 * HB_FEATURE_GLOBAL_END
703 *
704 * Since: 2.0.0
705 */
706#define HB_FEATURE_GLOBAL_END ((unsigned int) -1)
707
708/**
709 * hb_feature_t:
710 * @tag: The #hb_tag_t tag of the feature
711 * @value: The value of the feature. 0 disables the feature, non-zero (usually
712 * 1) enables the feature. For features implemented as lookup type 3 (like
713 * 'salt') the @value is a one based index into the alternates.
714 * @start: the cluster to start applying this feature setting (inclusive).
715 * @end: the cluster to end applying this feature setting (exclusive).
716 *
717 * The #hb_feature_t is the structure that holds information about requested
718 * feature application. The feature will be applied with the given value to all
719 * glyphs which are in clusters between @start (inclusive) and @end (exclusive).
720 * Setting start to @HB_FEATURE_GLOBAL_START and end to @HB_FEATURE_GLOBAL_END
721 * specifies that the feature always applies to the entire buffer.
722 */
723typedef struct hb_feature_t {
724 hb_tag_t tag;
725 uint32_t value;
726 unsigned int start;
727 unsigned int end;
728} hb_feature_t;
729
730HB_EXTERN hb_bool_t
731hb_feature_from_string (const char *str, int len,
732 hb_feature_t *feature);
733
734HB_EXTERN void
735hb_feature_to_string (hb_feature_t *feature,
736 char *buf, unsigned int size);
737
738/**
739 * hb_variation_t:
740 * @tag: The #hb_tag_t tag of the variation-axis name
741 * @value: The value of the variation axis
742 *
743 * Data type for holding variation data. Registered OpenType
744 * variation-axis tags are listed at
745 * https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxisreg
746 *
747 * Since: 1.4.2
748 */
749typedef struct hb_variation_t {
750 hb_tag_t tag;
751 float value;
752} hb_variation_t;
753
754HB_EXTERN hb_bool_t
755hb_variation_from_string (const char *str, int len,
756 hb_variation_t *variation);
757
758HB_EXTERN void
759hb_variation_to_string (hb_variation_t *variation,
760 char *buf, unsigned int size);
761
762/**
763 * hb_color_t:
764 *
765 * Data type for holding color values. Colors are eight bits per
766 * channel RGB plus alpha transparency.
767 *
768 * Since: 2.1.0
769 */
770typedef uint32_t hb_color_t;
771
772#define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a)))
773
774HB_EXTERN uint8_t
775hb_color_get_alpha (hb_color_t color);
776#define hb_color_get_alpha(color) ((color) & 0xFF)
777
778HB_EXTERN uint8_t
779hb_color_get_red (hb_color_t color);
780#define hb_color_get_red(color) (((color) >> 8) & 0xFF)
781
782HB_EXTERN uint8_t
783hb_color_get_green (hb_color_t color);
784#define hb_color_get_green(color) (((color) >> 16) & 0xFF)
785
786HB_EXTERN uint8_t
787hb_color_get_blue (hb_color_t color);
788#define hb_color_get_blue(color) (((color) >> 24) & 0xFF)
789
790HB_END_DECLS
791
792#endif /* HB_COMMON_H */
793

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