File indexing completed on 2025-09-17 09:01:46
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #if !defined(HB_H_IN) && !defined(HB_NO_SINGLE_HEADER_ERROR)
0030 #error "Include <hb.h> instead."
0031 #endif
0032
0033 #ifndef HB_COMMON_H
0034 #define HB_COMMON_H
0035
0036 #ifndef HB_EXTERN
0037 #define HB_EXTERN extern
0038 #endif
0039
0040 #ifndef HB_BEGIN_DECLS
0041 # ifdef __cplusplus
0042 # define HB_BEGIN_DECLS extern "C" {
0043 # define HB_END_DECLS }
0044 # else
0045 # define HB_BEGIN_DECLS
0046 # define HB_END_DECLS
0047 # endif
0048 #endif
0049
0050 #if defined (_AIX)
0051 # include <sys/inttypes.h>
0052 #elif defined (_MSC_VER) && _MSC_VER < 1600
0053
0054 typedef __int8 int8_t;
0055 typedef unsigned __int8 uint8_t;
0056 typedef __int16 int16_t;
0057 typedef unsigned __int16 uint16_t;
0058 typedef __int32 int32_t;
0059 typedef unsigned __int32 uint32_t;
0060 typedef __int64 int64_t;
0061 typedef unsigned __int64 uint64_t;
0062 #elif defined (_MSC_VER) && _MSC_VER < 1800
0063
0064 # include <stdint.h>
0065 #else
0066 # include <inttypes.h>
0067 #endif
0068 #include <stddef.h>
0069
0070 #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
0071 #define HB_DEPRECATED __attribute__((__deprecated__))
0072 #elif defined(_MSC_VER) && (_MSC_VER >= 1300)
0073 #define HB_DEPRECATED __declspec(deprecated)
0074 #else
0075 #define HB_DEPRECATED
0076 #endif
0077
0078 #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
0079 #define HB_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
0080 #elif defined(_MSC_FULL_VER) && (_MSC_FULL_VER > 140050320)
0081 #define HB_DEPRECATED_FOR(f) __declspec(deprecated("is deprecated. Use '" #f "' instead"))
0082 #else
0083 #define HB_DEPRECATED_FOR(f) HB_DEPRECATED
0084 #endif
0085
0086
0087 HB_BEGIN_DECLS
0088
0089
0090
0091
0092
0093
0094
0095 typedef int hb_bool_t;
0096
0097
0098
0099
0100
0101
0102
0103
0104 typedef uint32_t hb_codepoint_t;
0105
0106
0107
0108
0109
0110
0111
0112
0113 #define HB_CODEPOINT_INVALID ((hb_codepoint_t) -1)
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123 typedef int32_t hb_position_t;
0124
0125
0126
0127
0128
0129
0130 typedef uint32_t hb_mask_t;
0131
0132 typedef union _hb_var_int_t {
0133 uint32_t u32;
0134 int32_t i32;
0135 uint16_t u16[2];
0136 int16_t i16[2];
0137 uint8_t u8[4];
0138 int8_t i8[4];
0139 } hb_var_int_t;
0140
0141 typedef union _hb_var_num_t {
0142 float f;
0143 uint32_t u32;
0144 int32_t i32;
0145 uint16_t u16[2];
0146 int16_t i16[2];
0147 uint8_t u8[4];
0148 int8_t i8[4];
0149 } hb_var_num_t;
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165 typedef uint32_t hb_tag_t;
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177 #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)))
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 #define HB_UNTAG(tag) (uint8_t)(((tag)>>24)&0xFF), (uint8_t)(((tag)>>16)&0xFF), (uint8_t)(((tag)>>8)&0xFF), (uint8_t)((tag)&0xFF)
0189
0190
0191
0192
0193
0194
0195 #define HB_TAG_NONE HB_TAG(0,0,0,0)
0196
0197
0198
0199
0200
0201
0202
0203 #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff)
0204
0205
0206
0207
0208
0209
0210
0211 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff)
0212
0213
0214 HB_EXTERN hb_tag_t
0215 hb_tag_from_string (const char *str, int len);
0216
0217
0218 HB_EXTERN void
0219 hb_tag_to_string (hb_tag_t tag, char *buf);
0220
0221
0222
0223
0224
0225
0226
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237 typedef enum {
0238 HB_DIRECTION_INVALID = 0,
0239 HB_DIRECTION_LTR = 4,
0240 HB_DIRECTION_RTL,
0241 HB_DIRECTION_TTB,
0242 HB_DIRECTION_BTT
0243 } hb_direction_t;
0244
0245
0246 HB_EXTERN hb_direction_t
0247 hb_direction_from_string (const char *str, int len);
0248
0249 HB_EXTERN const char *
0250 hb_direction_to_string (hb_direction_t direction);
0251
0252
0253
0254
0255
0256
0257
0258
0259 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
0260
0261
0262
0263
0264
0265
0266
0267
0268
0269 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
0270
0271
0272
0273
0274
0275
0276
0277
0278 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
0279
0280
0281
0282
0283
0284
0285
0286
0287 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
0288
0289
0290
0291
0292
0293
0294
0295
0296 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
0297
0298
0299
0300
0301
0302
0303
0304
0305 #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1))
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317 typedef const struct hb_language_impl_t *hb_language_t;
0318
0319 HB_EXTERN hb_language_t
0320 hb_language_from_string (const char *str, int len);
0321
0322 HB_EXTERN const char *
0323 hb_language_to_string (hb_language_t language);
0324
0325
0326
0327
0328
0329
0330
0331
0332 #define HB_LANGUAGE_INVALID ((hb_language_t) 0)
0333
0334 HB_EXTERN hb_language_t
0335 hb_language_get_default (void);
0336
0337 HB_EXTERN hb_bool_t
0338 hb_language_matches (hb_language_t language,
0339 hb_language_t specific);
0340
0341 #include "hb-script-list.h"
0342
0343
0344
0345 HB_EXTERN hb_script_t
0346 hb_script_from_iso15924_tag (hb_tag_t tag);
0347
0348 HB_EXTERN hb_script_t
0349 hb_script_from_string (const char *str, int len);
0350
0351 HB_EXTERN hb_tag_t
0352 hb_script_to_iso15924_tag (hb_script_t script);
0353
0354 HB_EXTERN hb_direction_t
0355 hb_script_get_horizontal_direction (hb_script_t script);
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366 typedef struct hb_user_data_key_t {
0367
0368 char unused;
0369 } hb_user_data_key_t;
0370
0371
0372
0373
0374
0375
0376
0377
0378 typedef void (*hb_destroy_func_t) (void *user_data);
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391 #define HB_FEATURE_GLOBAL_START 0
0392
0393
0394
0395
0396
0397
0398
0399
0400
0401 #define HB_FEATURE_GLOBAL_END ((unsigned int) -1)
0402
0403
0404
0405
0406
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418 typedef struct hb_feature_t {
0419 hb_tag_t tag;
0420 uint32_t value;
0421 unsigned int start;
0422 unsigned int end;
0423 } hb_feature_t;
0424
0425 HB_EXTERN hb_bool_t
0426 hb_feature_from_string (const char *str, int len,
0427 hb_feature_t *feature);
0428
0429 HB_EXTERN void
0430 hb_feature_to_string (hb_feature_t *feature,
0431 char *buf, unsigned int size);
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441
0442
0443
0444 typedef struct hb_variation_t {
0445 hb_tag_t tag;
0446 float value;
0447 } hb_variation_t;
0448
0449 HB_EXTERN hb_bool_t
0450 hb_variation_from_string (const char *str, int len,
0451 hb_variation_t *variation);
0452
0453 HB_EXTERN void
0454 hb_variation_to_string (hb_variation_t *variation,
0455 char *buf, unsigned int size);
0456
0457
0458
0459
0460
0461
0462
0463
0464
0465 typedef uint32_t hb_color_t;
0466
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478 #define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a)))
0479
0480 HB_EXTERN uint8_t
0481 hb_color_get_alpha (hb_color_t color);
0482 #define hb_color_get_alpha(color) ((color) & 0xFF)
0483
0484 HB_EXTERN uint8_t
0485 hb_color_get_red (hb_color_t color);
0486 #define hb_color_get_red(color) (((color) >> 8) & 0xFF)
0487
0488 HB_EXTERN uint8_t
0489 hb_color_get_green (hb_color_t color);
0490 #define hb_color_get_green(color) (((color) >> 16) & 0xFF)
0491
0492 HB_EXTERN uint8_t
0493 hb_color_get_blue (hb_color_t color);
0494 #define hb_color_get_blue(color) (((color) >> 24) & 0xFF)
0495
0496
0497
0498
0499
0500
0501
0502
0503
0504
0505
0506
0507 typedef struct hb_glyph_extents_t {
0508 hb_position_t x_bearing;
0509 hb_position_t y_bearing;
0510 hb_position_t width;
0511 hb_position_t height;
0512 } hb_glyph_extents_t;
0513
0514
0515
0516
0517
0518
0519
0520 typedef struct hb_font_t hb_font_t;
0521
0522
0523 HB_EXTERN void*
0524 hb_malloc (size_t size);
0525 HB_EXTERN void*
0526 hb_calloc (size_t nmemb, size_t size);
0527 HB_EXTERN void*
0528 hb_realloc (void *ptr, size_t size);
0529 HB_EXTERN void
0530 hb_free (void *ptr);
0531
0532 HB_END_DECLS
0533
0534 #endif