| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright © 2007,2008,2009 Red Hat, Inc. | 2 * Copyright © 2007,2008,2009 Red Hat, Inc. |
| 3 * Copyright © 2011,2012 Google, Inc. | 3 * Copyright © 2011,2012 Google, Inc. |
| 4 * | 4 * |
| 5 * This is part of HarfBuzz, a text shaping library. | 5 * This is part of HarfBuzz, a text shaping library. |
| 6 * | 6 * |
| 7 * Permission is hereby granted, without written agreement and without | 7 * Permission is hereby granted, without written agreement and without |
| 8 * license or royalty fees, to use, copy, modify, and distribute this | 8 * license or royalty fees, to use, copy, modify, and distribute this |
| 9 * software and its documentation for any purpose, provided that the | 9 * software and its documentation for any purpose, provided that the |
| 10 * above copyright notice and the following two paragraphs appear in | 10 * above copyright notice and the following two paragraphs appear in |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 typedef uint32_t hb_tag_t; | 91 typedef uint32_t hb_tag_t; |
| 92 | 92 |
| 93 #define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<
16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) | 93 #define HB_TAG(c1,c2,c3,c4) ((hb_tag_t)((((uint8_t)(c1))<<24)|(((uint8_t)(c2))<<
16)|(((uint8_t)(c3))<<8)|((uint8_t)(c4)))) |
| 94 #define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_
t)((tag)>>8)), ((uint8_t)(tag)) | 94 #define HB_UNTAG(tag) ((uint8_t)((tag)>>24)), ((uint8_t)((tag)>>16)), ((uint8_
t)((tag)>>8)), ((uint8_t)(tag)) |
| 95 | 95 |
| 96 #define HB_TAG_NONE HB_TAG(0,0,0,0) | 96 #define HB_TAG_NONE HB_TAG(0,0,0,0) |
| 97 #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) | 97 #define HB_TAG_MAX HB_TAG(0xff,0xff,0xff,0xff) |
| 98 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff) | 98 #define HB_TAG_MAX_SIGNED HB_TAG(0x7f,0xff,0xff,0xff) |
| 99 | 99 |
| 100 /* len=-1 means str is NUL-terminated. */ | 100 /* len=-1 means str is NUL-terminated. */ |
| 101 hb_tag_t | 101 HB_EXTERN hb_tag_t |
| 102 hb_tag_from_string (const char *str, int len); | 102 hb_tag_from_string (const char *str, int len); |
| 103 | 103 |
| 104 /* buf should have 4 bytes. */ | 104 /* buf should have 4 bytes. */ |
| 105 void | 105 HB_EXTERN void |
| 106 hb_tag_to_string (hb_tag_t tag, char *buf); | 106 hb_tag_to_string (hb_tag_t tag, char *buf); |
| 107 | 107 |
| 108 | 108 |
| 109 /* hb_direction_t */ | 109 /** |
| 110 | 110 * hb_direction_t: |
| 111 * @HB_DIRECTION_INVALID: Initial, unset direction. |
| 112 * @HB_DIRECTION_LTR: Text is set horizontally from left to right. |
| 113 * @HB_DIRECTION_RTL: Text is set horizontally from right to left. |
| 114 * @HB_DIRECTION_TTB: Text is set vertically from top to bottom. |
| 115 * @HB_DIRECTION_BTT: Text is set vertically from bottom to top. |
| 116 */ |
| 111 typedef enum { | 117 typedef enum { |
| 112 HB_DIRECTION_INVALID = 0, | 118 HB_DIRECTION_INVALID = 0, |
| 113 HB_DIRECTION_LTR = 4, | 119 HB_DIRECTION_LTR = 4, |
| 114 HB_DIRECTION_RTL, | 120 HB_DIRECTION_RTL, |
| 115 HB_DIRECTION_TTB, | 121 HB_DIRECTION_TTB, |
| 116 HB_DIRECTION_BTT | 122 HB_DIRECTION_BTT |
| 117 } hb_direction_t; | 123 } hb_direction_t; |
| 118 | 124 |
| 119 /* len=-1 means str is NUL-terminated */ | 125 /* len=-1 means str is NUL-terminated */ |
| 120 hb_direction_t | 126 HB_EXTERN hb_direction_t |
| 121 hb_direction_from_string (const char *str, int len); | 127 hb_direction_from_string (const char *str, int len); |
| 122 | 128 |
| 123 const char * | 129 HB_EXTERN const char * |
| 124 hb_direction_to_string (hb_direction_t direction); | 130 hb_direction_to_string (hb_direction_t direction); |
| 125 | 131 |
| 126 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4) | 132 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4) |
| 127 /* Direction must be valid for the following */ | 133 /* Direction must be valid for the following */ |
| 128 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4) | 134 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4) |
| 129 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) | 135 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) |
| 130 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) | 136 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) |
| 131 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) | 137 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) |
| 132 #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)
) ^ 1)) | 138 #define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)
) ^ 1)) |
| 133 | 139 |
| 134 | 140 |
| 135 /* hb_language_t */ | 141 /* hb_language_t */ |
| 136 | 142 |
| 137 typedef const struct hb_language_impl_t *hb_language_t; | 143 typedef const struct hb_language_impl_t *hb_language_t; |
| 138 | 144 |
| 139 /* len=-1 means str is NUL-terminated */ | 145 HB_EXTERN hb_language_t |
| 140 hb_language_t | |
| 141 hb_language_from_string (const char *str, int len); | 146 hb_language_from_string (const char *str, int len); |
| 142 | 147 |
| 143 const char * | 148 HB_EXTERN const char * |
| 144 hb_language_to_string (hb_language_t language); | 149 hb_language_to_string (hb_language_t language); |
| 145 | 150 |
| 146 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL) | 151 #define HB_LANGUAGE_INVALID ((hb_language_t) NULL) |
| 147 | 152 |
| 148 hb_language_t | 153 HB_EXTERN hb_language_t |
| 149 hb_language_get_default (void); | 154 hb_language_get_default (void); |
| 150 | 155 |
| 151 | 156 |
| 152 /* hb_script_t */ | 157 /* hb_script_t */ |
| 153 | 158 |
| 154 /* http://unicode.org/iso15924/ */ | 159 /* http://unicode.org/iso15924/ */ |
| 155 /* http://goo.gl/x9ilM */ | 160 /* http://goo.gl/x9ilM */ |
| 156 /* Unicode Character Database property: Script (sc) */ | 161 /* Unicode Character Database property: Script (sc) */ |
| 157 typedef enum | 162 typedef enum |
| 158 { | 163 { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 * http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html | 322 * http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html |
| 318 */ | 323 */ |
| 319 _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ | 324 _HB_SCRIPT_MAX_VALUE = HB_TAG_MAX, /*< skip >*/ |
| 320 _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/ | 325 _HB_SCRIPT_MAX_VALUE_SIGNED = HB_TAG_MAX_SIGNED /*< skip >*/ |
| 321 | 326 |
| 322 } hb_script_t; | 327 } hb_script_t; |
| 323 | 328 |
| 324 | 329 |
| 325 /* Script functions */ | 330 /* Script functions */ |
| 326 | 331 |
| 327 hb_script_t | 332 HB_EXTERN hb_script_t |
| 328 hb_script_from_iso15924_tag (hb_tag_t tag); | 333 hb_script_from_iso15924_tag (hb_tag_t tag); |
| 329 | 334 |
| 330 /* sugar for tag_from_string() then script_from_iso15924_tag */ | 335 HB_EXTERN hb_script_t |
| 331 /* len=-1 means s is NUL-terminated */ | 336 hb_script_from_string (const char *str, int len); |
| 332 hb_script_t | |
| 333 hb_script_from_string (const char *s, int len); | |
| 334 | 337 |
| 335 hb_tag_t | 338 HB_EXTERN hb_tag_t |
| 336 hb_script_to_iso15924_tag (hb_script_t script); | 339 hb_script_to_iso15924_tag (hb_script_t script); |
| 337 | 340 |
| 338 hb_direction_t | 341 HB_EXTERN hb_direction_t |
| 339 hb_script_get_horizontal_direction (hb_script_t script); | 342 hb_script_get_horizontal_direction (hb_script_t script); |
| 340 | 343 |
| 341 | 344 |
| 342 /* User data */ | 345 /* User data */ |
| 343 | 346 |
| 344 typedef struct hb_user_data_key_t { | 347 typedef struct hb_user_data_key_t { |
| 345 /*< private >*/ | 348 /*< private >*/ |
| 346 char unused; | 349 char unused; |
| 347 } hb_user_data_key_t; | 350 } hb_user_data_key_t; |
| 348 | 351 |
| 349 typedef void (*hb_destroy_func_t) (void *user_data); | 352 typedef void (*hb_destroy_func_t) (void *user_data); |
| 350 | 353 |
| 351 | 354 |
| 352 HB_END_DECLS | 355 HB_END_DECLS |
| 353 | 356 |
| 354 #endif /* HB_COMMON_H */ | 357 #endif /* HB_COMMON_H */ |
| OLD | NEW |