Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-common.h

Issue 475363002: Roll HarfBuzz to 0.9.35 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows build fix attempt Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 /* hb_tag_t */ 89 /* hb_tag_t */
90 90
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 99
99 /* len=-1 means str is NUL-terminated. */ 100 /* len=-1 means str is NUL-terminated. */
100 hb_tag_t 101 hb_tag_t
101 hb_tag_from_string (const char *str, int len); 102 hb_tag_from_string (const char *str, int len);
102 103
103 /* buf should have 4 bytes. */ 104 /* buf should have 4 bytes. */
104 void 105 void
105 hb_tag_to_string (hb_tag_t tag, char *buf); 106 hb_tag_to_string (hb_tag_t tag, char *buf);
106 107
107 108
108 /* hb_direction_t */ 109 /* hb_direction_t */
109 110
110 typedef enum { 111 typedef enum {
111 HB_DIRECTION_INVALID = 0, 112 HB_DIRECTION_INVALID = 0,
112 HB_DIRECTION_LTR = 4, 113 HB_DIRECTION_LTR = 4,
113 HB_DIRECTION_RTL, 114 HB_DIRECTION_RTL,
114 HB_DIRECTION_TTB, 115 HB_DIRECTION_TTB,
115 HB_DIRECTION_BTT 116 HB_DIRECTION_BTT
116 } hb_direction_t; 117 } hb_direction_t;
117 118
118 /* len=-1 means str is NUL-terminated */ 119 /* len=-1 means str is NUL-terminated */
119 hb_direction_t 120 hb_direction_t
120 hb_direction_from_string (const char *str, int len); 121 hb_direction_from_string (const char *str, int len);
121 122
122 const char * 123 const char *
123 hb_direction_to_string (hb_direction_t direction); 124 hb_direction_to_string (hb_direction_t direction);
124 125
126 #define HB_DIRECTION_IS_VALID(dir) ((((unsigned int) (dir)) & ~3U) == 4)
127 /* Direction must be valid for the following */
125 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4) 128 #define HB_DIRECTION_IS_HORIZONTAL(dir) ((((unsigned int) (dir)) & ~1U) == 4)
126 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6) 129 #define HB_DIRECTION_IS_VERTICAL(dir) ((((unsigned int) (dir)) & ~1U) == 6)
127 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4) 130 #define HB_DIRECTION_IS_FORWARD(dir) ((((unsigned int) (dir)) & ~2U) == 4)
128 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5) 131 #define HB_DIRECTION_IS_BACKWARD(dir) ((((unsigned int) (dir)) & ~2U) == 5)
129 #define HB_DIRECTION_IS_VALID(dir)» ((((unsigned int) (dir)) & ~3U) == 4) 132 #define HB_DIRECTION_REVERSE(dir)» ((hb_direction_t) (((unsigned int) (dir) ) ^ 1))
130 #define HB_DIRECTION_REVERSE(dir)» ((hb_direction_t) (((unsigned int) (dir) ) ^ 1)) /* Direction must be valid */
131 133
132 134
133 /* hb_language_t */ 135 /* hb_language_t */
134 136
135 typedef const struct hb_language_impl_t *hb_language_t; 137 typedef const struct hb_language_impl_t *hb_language_t;
136 138
137 /* len=-1 means str is NUL-terminated */ 139 /* len=-1 means str is NUL-terminated */
138 hb_language_t 140 hb_language_t
139 hb_language_from_string (const char *str, int len); 141 hb_language_from_string (const char *str, int len);
140 142
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 /*7.0*/ HB_SCRIPT_OLD_PERMIC = HB_TAG ('P','e','r','m'), 290 /*7.0*/ HB_SCRIPT_OLD_PERMIC = HB_TAG ('P','e','r','m'),
289 /*7.0*/ HB_SCRIPT_PAHAWH_HMONG = HB_TAG ('H','m','n','g'), 291 /*7.0*/ HB_SCRIPT_PAHAWH_HMONG = HB_TAG ('H','m','n','g'),
290 /*7.0*/ HB_SCRIPT_PALMYRENE = HB_TAG ('P','a','l','m'), 292 /*7.0*/ HB_SCRIPT_PALMYRENE = HB_TAG ('P','a','l','m'),
291 /*7.0*/ HB_SCRIPT_PAU_CIN_HAU = HB_TAG ('P','a','u','c'), 293 /*7.0*/ HB_SCRIPT_PAU_CIN_HAU = HB_TAG ('P','a','u','c'),
292 /*7.0*/ HB_SCRIPT_PSALTER_PAHLAVI = HB_TAG ('P','h','l','p'), 294 /*7.0*/ HB_SCRIPT_PSALTER_PAHLAVI = HB_TAG ('P','h','l','p'),
293 /*7.0*/ HB_SCRIPT_SIDDHAM = HB_TAG ('S','i','d','d'), 295 /*7.0*/ HB_SCRIPT_SIDDHAM = HB_TAG ('S','i','d','d'),
294 /*7.0*/ HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'), 296 /*7.0*/ HB_SCRIPT_TIRHUTA = HB_TAG ('T','i','r','h'),
295 /*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'), 297 /*7.0*/ HB_SCRIPT_WARANG_CITI = HB_TAG ('W','a','r','a'),
296 298
297 /* No script set. */ 299 /* No script set. */
298 /*---*/ HB_SCRIPT_INVALID» » » = HB_TAG_NONE, 300 HB_SCRIPT_INVALID» » » » = HB_TAG_NONE,
299 301
300 /* Dummy value to ensure any hb_tag_t value can be passed/stored as hb_script_ t 302 /* Dummy values to ensure any hb_tag_t value can be passed/stored as hb_script _t
301 * without risking undefined behavior. */ 303 * without risking undefined behavior. Include both a signed and unsigned max ,
302 /*---*/ _HB_SCRIPT_MAX_VALUE» » » = HB_TAG_MAX 304 * since technically enums are int, and indeed, hb_script_t ends up being sign ed.
305 * See this thread for technicalities:
306 *
307 * http://lists.freedesktop.org/archives/harfbuzz/2014-March/004150.html
308 */
309 _HB_SCRIPT_MAX_VALUE» » » » = HB_TAG_MAX, /*< skip >*/
310 _HB_SCRIPT_MAX_VALUE_SIGNED» » » = HB_TAG_MAX_SIGNED /*< skip >*/
303 311
304 } hb_script_t; 312 } hb_script_t;
305 313
306 314
307 /* Script functions */ 315 /* Script functions */
308 316
309 hb_script_t 317 hb_script_t
310 hb_script_from_iso15924_tag (hb_tag_t tag); 318 hb_script_from_iso15924_tag (hb_tag_t tag);
311 319
312 /* suger for tag_from_string() then script_from_iso15924_tag */ 320 /* sugar for tag_from_string() then script_from_iso15924_tag */
313 /* len=-1 means s is NUL-terminated */ 321 /* len=-1 means s is NUL-terminated */
314 hb_script_t 322 hb_script_t
315 hb_script_from_string (const char *s, int len); 323 hb_script_from_string (const char *s, int len);
316 324
317 hb_tag_t 325 hb_tag_t
318 hb_script_to_iso15924_tag (hb_script_t script); 326 hb_script_to_iso15924_tag (hb_script_t script);
319 327
320 hb_direction_t 328 hb_direction_t
321 hb_script_get_horizontal_direction (hb_script_t script); 329 hb_script_get_horizontal_direction (hb_script_t script);
322 330
323 331
324 /* User data */ 332 /* User data */
325 333
326 typedef struct hb_user_data_key_t { 334 typedef struct hb_user_data_key_t {
327 /*< private >*/ 335 /*< private >*/
328 char unused; 336 char unused;
329 } hb_user_data_key_t; 337 } hb_user_data_key_t;
330 338
331 typedef void (*hb_destroy_func_t) (void *user_data); 339 typedef void (*hb_destroy_func_t) (void *user_data);
332 340
333 341
334 HB_END_DECLS 342 HB_END_DECLS
335 343
336 #endif /* HB_COMMON_H */ 344 #endif /* HB_COMMON_H */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-buffer-private.hh ('k') | third_party/harfbuzz-ng/src/hb-common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698