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

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

Issue 1580513002: Roll HarfBuzz to 1.1.3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix Created 4 years, 11 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
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-blob.h ('k') | third_party/harfbuzz-ng/src/hb-buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright © 1998-2004 David Turner and Werner Lemberg 2 * Copyright © 1998-2004 David Turner and Werner Lemberg
3 * Copyright © 2004,2007,2009 Red Hat, Inc. 3 * Copyright © 2004,2007,2009 Red Hat, Inc.
4 * Copyright © 2011,2012 Google, Inc. 4 * Copyright © 2011,2012 Google, Inc.
5 * 5 *
6 * This is part of HarfBuzz, a text shaping library. 6 * This is part of HarfBuzz, a text shaping library.
7 * 7 *
8 * Permission is hereby granted, without written agreement and without 8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this 9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the 10 * software and its documentation for any purpose, provided that the
(...skipping 22 matching lines...) Expand all
33 33
34 #ifndef HB_BUFFER_H 34 #ifndef HB_BUFFER_H
35 #define HB_BUFFER_H 35 #define HB_BUFFER_H
36 36
37 #include "hb-common.h" 37 #include "hb-common.h"
38 #include "hb-unicode.h" 38 #include "hb-unicode.h"
39 #include "hb-font.h" 39 #include "hb-font.h"
40 40
41 HB_BEGIN_DECLS 41 HB_BEGIN_DECLS
42 42
43 43 /**
44 * hb_glyph_info_t:
45 * @codepoint: either a Unicode code point (before shaping) or a glyph index
46 * (after shaping).
47 * @mask:
48 * @cluster: the index of the character in the original text that corresponds
49 * to this #hb_glyph_info_t, or whatever the client passes to
50 * hb_buffer_add(). More than one #hb_glyph_info_t can have the same
51 * @cluster value, if they resulted from the same character (e.g. one
52 * to many glyph substitution), and when more than one character gets
53 * merged in the same glyph (e.g. many to one glyph substitution) the
54 * #hb_glyph_info_t will have the smallest cluster value of them.
55 * By default some characters are merged into the same cluster
56 * (e.g. combining marks have the same cluster as their bases)
57 * even if they are separate glyphs, hb_buffer_set_cluster_level()
58 * allow selecting more fine-grained cluster handling.
59 *
60 * The #hb_glyph_info_t is the structure that holds information about the
61 * glyphs and their relation to input text.
62 *
63 */
44 typedef struct hb_glyph_info_t { 64 typedef struct hb_glyph_info_t {
45 hb_codepoint_t codepoint; 65 hb_codepoint_t codepoint;
46 hb_mask_t mask; 66 hb_mask_t mask;
47 uint32_t cluster; 67 uint32_t cluster;
48 68
49 /*< private >*/ 69 /*< private >*/
50 hb_var_int_t var1; 70 hb_var_int_t var1;
51 hb_var_int_t var2; 71 hb_var_int_t var2;
52 } hb_glyph_info_t; 72 } hb_glyph_info_t;
53 73
74 /**
75 * hb_glyph_position_t:
76 * @x_advance: how much the line advances after drawing this glyph when setting
77 * text in horizontal direction.
78 * @y_advance: how much the line advances after drawing this glyph when setting
79 * text in vertical direction.
80 * @x_offset: how much the glyph moves on the X-axis before drawing it, this
81 * should not affect how much the line advances.
82 * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
83 * should not affect how much the line advances.
84 *
85 * The #hb_glyph_position_t is the structure that holds the positions of the
86 * glyph in both horizontal and vertical directions. All positions in
87 * #hb_glyph_position_t are relative to the current point.
88 *
89 */
54 typedef struct hb_glyph_position_t { 90 typedef struct hb_glyph_position_t {
55 hb_position_t x_advance; 91 hb_position_t x_advance;
56 hb_position_t y_advance; 92 hb_position_t y_advance;
57 hb_position_t x_offset; 93 hb_position_t x_offset;
58 hb_position_t y_offset; 94 hb_position_t y_offset;
59 95
60 /*< private >*/ 96 /*< private >*/
61 hb_var_int_t var; 97 hb_var_int_t var;
62 } hb_glyph_position_t; 98 } hb_glyph_position_t;
63 99
64 100 /**
101 * hb_segment_properties_t:
102 * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
103 * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
104 * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
105 *
106 * The structure that holds various text properties of an #hb_buffer_t. Can be
107 * set and retrieved using hb_buffer_set_segment_properties() and
108 * hb_buffer_get_segment_properties(), respectively.
109 */
65 typedef struct hb_segment_properties_t { 110 typedef struct hb_segment_properties_t {
66 hb_direction_t direction; 111 hb_direction_t direction;
67 hb_script_t script; 112 hb_script_t script;
68 hb_language_t language; 113 hb_language_t language;
69 /*< private >*/ 114 /*< private >*/
70 void *reserved1; 115 void *reserved1;
71 void *reserved2; 116 void *reserved2;
72 } hb_segment_properties_t; 117 } hb_segment_properties_t;
73 118
74 #define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \ 119 #define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
75 HB_SCRIPT_INVALID, \ 120 HB_SCRIPT_INVALID, \
76 HB_LANGUAGE_INVALID, \ 121 HB_LANGUAGE_INVALID, \
77 NULL, \ 122 NULL, \
78 NULL} 123 NULL}
79 124
80 hb_bool_t 125 HB_EXTERN hb_bool_t
81 hb_segment_properties_equal (const hb_segment_properties_t *a, 126 hb_segment_properties_equal (const hb_segment_properties_t *a,
82 const hb_segment_properties_t *b); 127 const hb_segment_properties_t *b);
83 128
84 unsigned int 129 HB_EXTERN unsigned int
85 hb_segment_properties_hash (const hb_segment_properties_t *p); 130 hb_segment_properties_hash (const hb_segment_properties_t *p);
86 131
87 132
88 133
89 /* 134 /**
90 * hb_buffer_t 135 * hb_buffer_t:
136 *
137 * The main structure holding the input text and its properties before shaping,
138 * and output glyphs and their information after shaping.
91 */ 139 */
92 140
93 typedef struct hb_buffer_t hb_buffer_t; 141 typedef struct hb_buffer_t hb_buffer_t;
94 142
95 hb_buffer_t * 143 HB_EXTERN hb_buffer_t *
96 hb_buffer_create (void); 144 hb_buffer_create (void);
97 145
98 hb_buffer_t * 146 HB_EXTERN hb_buffer_t *
99 hb_buffer_get_empty (void); 147 hb_buffer_get_empty (void);
100 148
101 hb_buffer_t * 149 HB_EXTERN hb_buffer_t *
102 hb_buffer_reference (hb_buffer_t *buffer); 150 hb_buffer_reference (hb_buffer_t *buffer);
103 151
104 void 152 HB_EXTERN void
105 hb_buffer_destroy (hb_buffer_t *buffer); 153 hb_buffer_destroy (hb_buffer_t *buffer);
106 154
107 hb_bool_t 155 HB_EXTERN hb_bool_t
108 hb_buffer_set_user_data (hb_buffer_t *buffer, 156 hb_buffer_set_user_data (hb_buffer_t *buffer,
109 hb_user_data_key_t *key, 157 hb_user_data_key_t *key,
110 void * data, 158 void * data,
111 hb_destroy_func_t destroy, 159 hb_destroy_func_t destroy,
112 hb_bool_t replace); 160 hb_bool_t replace);
113 161
114 void * 162 HB_EXTERN void *
115 hb_buffer_get_user_data (hb_buffer_t *buffer, 163 hb_buffer_get_user_data (hb_buffer_t *buffer,
116 hb_user_data_key_t *key); 164 hb_user_data_key_t *key);
117 165
118 166 /**
167 * hb_buffer_content_type_t:
168 * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
169 * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
170 * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shap ing).
171 */
119 typedef enum { 172 typedef enum {
120 HB_BUFFER_CONTENT_TYPE_INVALID = 0, 173 HB_BUFFER_CONTENT_TYPE_INVALID = 0,
121 HB_BUFFER_CONTENT_TYPE_UNICODE, 174 HB_BUFFER_CONTENT_TYPE_UNICODE,
122 HB_BUFFER_CONTENT_TYPE_GLYPHS 175 HB_BUFFER_CONTENT_TYPE_GLYPHS
123 } hb_buffer_content_type_t; 176 } hb_buffer_content_type_t;
124 177
125 void 178 HB_EXTERN void
126 hb_buffer_set_content_type (hb_buffer_t *buffer, 179 hb_buffer_set_content_type (hb_buffer_t *buffer,
127 hb_buffer_content_type_t content_type); 180 hb_buffer_content_type_t content_type);
128 181
129 hb_buffer_content_type_t 182 HB_EXTERN hb_buffer_content_type_t
130 hb_buffer_get_content_type (hb_buffer_t *buffer); 183 hb_buffer_get_content_type (hb_buffer_t *buffer);
131 184
132 185
133 void 186 HB_EXTERN void
134 hb_buffer_set_unicode_funcs (hb_buffer_t *buffer, 187 hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
135 hb_unicode_funcs_t *unicode_funcs); 188 hb_unicode_funcs_t *unicode_funcs);
136 189
137 hb_unicode_funcs_t * 190 HB_EXTERN hb_unicode_funcs_t *
138 hb_buffer_get_unicode_funcs (hb_buffer_t *buffer); 191 hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
139 192
140 void 193 HB_EXTERN void
141 hb_buffer_set_direction (hb_buffer_t *buffer, 194 hb_buffer_set_direction (hb_buffer_t *buffer,
142 hb_direction_t direction); 195 hb_direction_t direction);
143 196
144 hb_direction_t 197 HB_EXTERN hb_direction_t
145 hb_buffer_get_direction (hb_buffer_t *buffer); 198 hb_buffer_get_direction (hb_buffer_t *buffer);
146 199
147 void 200 HB_EXTERN void
148 hb_buffer_set_script (hb_buffer_t *buffer, 201 hb_buffer_set_script (hb_buffer_t *buffer,
149 hb_script_t script); 202 hb_script_t script);
150 203
151 hb_script_t 204 HB_EXTERN hb_script_t
152 hb_buffer_get_script (hb_buffer_t *buffer); 205 hb_buffer_get_script (hb_buffer_t *buffer);
153 206
154 void 207 HB_EXTERN void
155 hb_buffer_set_language (hb_buffer_t *buffer, 208 hb_buffer_set_language (hb_buffer_t *buffer,
156 hb_language_t language); 209 hb_language_t language);
157 210
158 211
159 hb_language_t 212 HB_EXTERN hb_language_t
160 hb_buffer_get_language (hb_buffer_t *buffer); 213 hb_buffer_get_language (hb_buffer_t *buffer);
161 214
162 void 215 HB_EXTERN void
163 hb_buffer_set_segment_properties (hb_buffer_t *buffer, 216 hb_buffer_set_segment_properties (hb_buffer_t *buffer,
164 const hb_segment_properties_t *props); 217 const hb_segment_properties_t *props);
165 218
166 void 219 HB_EXTERN void
167 hb_buffer_get_segment_properties (hb_buffer_t *buffer, 220 hb_buffer_get_segment_properties (hb_buffer_t *buffer,
168 hb_segment_properties_t *props); 221 hb_segment_properties_t *props);
169 222
170 void 223 HB_EXTERN void
171 hb_buffer_guess_segment_properties (hb_buffer_t *buffer); 224 hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
172 225
173 226
174 /* 227 /**
228 * hb_buffer_flags_t:
229 * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
230 * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
231 * of text paragraph can be applied to this buffer. Should usually
232 * be set, unless you are passing to the buffer only part
233 * of the text without the full context.
234 * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
235 * paragraph can be applied to this buffer, similar to
236 * @HB_BUFFER_FLAG_EOT.
237 * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
238 * flag indication that character with Default_Ignorable
239 * Unicode property should use the corresponding glyph
240 * from the font, instead of hiding them (currently done
241 * by replacing them with the space glyph and zeroing the
242 * advance width.)
243 *
175 * Since: 0.9.20 244 * Since: 0.9.20
176 */ 245 */
177 typedef enum { /*< flags >*/ 246 typedef enum { /*< flags >*/
178 HB_BUFFER_FLAG_DEFAULT = 0x00000000u, 247 HB_BUFFER_FLAG_DEFAULT = 0x00000000u,
179 HB_BUFFER_FLAG_BOT = 0x00000001u, /* Beginning-of-t ext */ 248 HB_BUFFER_FLAG_BOT = 0x00000001u, /* Beginning-of-t ext */
180 HB_BUFFER_FLAG_EOT = 0x00000002u, /* End-of-text */ 249 HB_BUFFER_FLAG_EOT = 0x00000002u, /* End-of-text */
181 HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u 250 HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u
182 } hb_buffer_flags_t; 251 } hb_buffer_flags_t;
183 252
184 void 253 HB_EXTERN void
185 hb_buffer_set_flags (hb_buffer_t *buffer, 254 hb_buffer_set_flags (hb_buffer_t *buffer,
186 hb_buffer_flags_t flags); 255 hb_buffer_flags_t flags);
187 256
188 hb_buffer_flags_t 257 HB_EXTERN hb_buffer_flags_t
189 hb_buffer_get_flags (hb_buffer_t *buffer); 258 hb_buffer_get_flags (hb_buffer_t *buffer);
190 259
191 /* 260 /*
192 * Since: 0.9.42 261 * Since: 0.9.42
193 */ 262 */
194 typedef enum { 263 typedef enum {
195 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = 0, 264 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = 0,
196 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = 1, 265 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = 1,
197 HB_BUFFER_CLUSTER_LEVEL_CHARACTERS = 2, 266 HB_BUFFER_CLUSTER_LEVEL_CHARACTERS = 2,
198 HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES 267 HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
199 } hb_buffer_cluster_level_t; 268 } hb_buffer_cluster_level_t;
200 269
201 void 270 HB_EXTERN void
202 hb_buffer_set_cluster_level (hb_buffer_t *buffer, 271 hb_buffer_set_cluster_level (hb_buffer_t *buffer,
203 hb_buffer_cluster_level_t cluster_level); 272 hb_buffer_cluster_level_t cluster_level);
204 273
205 hb_buffer_cluster_level_t 274 HB_EXTERN hb_buffer_cluster_level_t
206 hb_buffer_get_cluster_level (hb_buffer_t *buffer); 275 hb_buffer_get_cluster_level (hb_buffer_t *buffer);
207 276
277 /**
278 * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
279 *
280 * The default code point for replacing invalid characters in a given encoding.
281 * Set to U+FFFD REPLACEMENT CHARACTER.
282 *
283 * Since: 0.9.31
284 */
208 #define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu 285 #define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
209 286
210 /* Sets codepoint used to replace invalid UTF-8/16/32 entries. 287 HB_EXTERN void
211 * Default is 0xFFFDu. */
212 void
213 hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer, 288 hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
214 hb_codepoint_t replacement); 289 hb_codepoint_t replacement);
215 290
216 hb_codepoint_t 291 HB_EXTERN hb_codepoint_t
217 hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer); 292 hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer);
218 293
219 294
220 /* Resets the buffer. Afterwards it's as if it was just created, 295 HB_EXTERN void
221 * except that it has a larger buffer allocated perhaps... */
222 void
223 hb_buffer_reset (hb_buffer_t *buffer); 296 hb_buffer_reset (hb_buffer_t *buffer);
224 297
225 /* Like reset, but does NOT clear unicode_funcs and replacement_codepoint. */ 298 HB_EXTERN void
226 void
227 hb_buffer_clear_contents (hb_buffer_t *buffer); 299 hb_buffer_clear_contents (hb_buffer_t *buffer);
228 300
229 /* Returns false if allocation failed */ 301 HB_EXTERN hb_bool_t
230 hb_bool_t
231 hb_buffer_pre_allocate (hb_buffer_t *buffer, 302 hb_buffer_pre_allocate (hb_buffer_t *buffer,
232 unsigned int size); 303 unsigned int size);
233 304
234 305
235 /* Returns false if allocation has failed before */ 306 HB_EXTERN hb_bool_t
236 hb_bool_t
237 hb_buffer_allocation_successful (hb_buffer_t *buffer); 307 hb_buffer_allocation_successful (hb_buffer_t *buffer);
238 308
239 void 309 HB_EXTERN void
240 hb_buffer_reverse (hb_buffer_t *buffer); 310 hb_buffer_reverse (hb_buffer_t *buffer);
241 311
242 void 312 HB_EXTERN void
243 hb_buffer_reverse_range (hb_buffer_t *buffer, 313 hb_buffer_reverse_range (hb_buffer_t *buffer,
244 unsigned int start, unsigned int end); 314 unsigned int start, unsigned int end);
245 315
246 void 316 HB_EXTERN void
247 hb_buffer_reverse_clusters (hb_buffer_t *buffer); 317 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
248 318
249 319
250 /* Filling the buffer in */ 320 /* Filling the buffer in */
251 321
252 void 322 HB_EXTERN void
253 hb_buffer_add (hb_buffer_t *buffer, 323 hb_buffer_add (hb_buffer_t *buffer,
254 hb_codepoint_t codepoint, 324 hb_codepoint_t codepoint,
255 unsigned int cluster); 325 unsigned int cluster);
256 326
257 void 327 HB_EXTERN void
258 hb_buffer_add_utf8 (hb_buffer_t *buffer, 328 hb_buffer_add_utf8 (hb_buffer_t *buffer,
259 const char *text, 329 const char *text,
260 int text_length, 330 int text_length,
261 unsigned int item_offset, 331 unsigned int item_offset,
262 int item_length); 332 int item_length);
263 333
264 void 334 HB_EXTERN void
265 hb_buffer_add_utf16 (hb_buffer_t *buffer, 335 hb_buffer_add_utf16 (hb_buffer_t *buffer,
266 const uint16_t *text, 336 const uint16_t *text,
267 int text_length, 337 int text_length,
268 unsigned int item_offset, 338 unsigned int item_offset,
269 int item_length); 339 int item_length);
270 340
271 void 341 HB_EXTERN void
272 hb_buffer_add_utf32 (hb_buffer_t *buffer, 342 hb_buffer_add_utf32 (hb_buffer_t *buffer,
273 const uint32_t *text, 343 const uint32_t *text,
274 int text_length, 344 int text_length,
275 unsigned int item_offset, 345 unsigned int item_offset,
276 int item_length); 346 int item_length);
277 347
278 /* Allows only access to first 256 Unicode codepoints. */ 348 HB_EXTERN void
279 void
280 hb_buffer_add_latin1 (hb_buffer_t *buffer, 349 hb_buffer_add_latin1 (hb_buffer_t *buffer,
281 const uint8_t *text, 350 const uint8_t *text,
282 int text_length, 351 int text_length,
283 unsigned int item_offset, 352 unsigned int item_offset,
284 int item_length); 353 int item_length);
285 354
286 /* Like add_utf32 but does NOT check for invalid Unicode codepoints. */ 355 HB_EXTERN void
287 void
288 hb_buffer_add_codepoints (hb_buffer_t *buffer, 356 hb_buffer_add_codepoints (hb_buffer_t *buffer,
289 const hb_codepoint_t *text, 357 const hb_codepoint_t *text,
290 int text_length, 358 int text_length,
291 unsigned int item_offset, 359 unsigned int item_offset,
292 int item_length); 360 int item_length);
293 361
294 362
295 /* Clears any new items added at the end */ 363 HB_EXTERN hb_bool_t
296 hb_bool_t
297 hb_buffer_set_length (hb_buffer_t *buffer, 364 hb_buffer_set_length (hb_buffer_t *buffer,
298 unsigned int length); 365 unsigned int length);
299 366
300 /* Return value valid as long as buffer not modified */ 367 HB_EXTERN unsigned int
301 unsigned int
302 hb_buffer_get_length (hb_buffer_t *buffer); 368 hb_buffer_get_length (hb_buffer_t *buffer);
303 369
304 /* Getting glyphs out of the buffer */ 370 /* Getting glyphs out of the buffer */
305 371
306 /* Return value valid as long as buffer not modified */ 372 HB_EXTERN hb_glyph_info_t *
307 hb_glyph_info_t *
308 hb_buffer_get_glyph_infos (hb_buffer_t *buffer, 373 hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
309 unsigned int *length); 374 unsigned int *length);
310 375
311 /* Return value valid as long as buffer not modified */ 376 HB_EXTERN hb_glyph_position_t *
312 hb_glyph_position_t *
313 hb_buffer_get_glyph_positions (hb_buffer_t *buffer, 377 hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
314 unsigned int *length); 378 unsigned int *length);
315 379
316 380
317 /* Reorders a glyph buffer to have canonical in-cluster glyph order / position. 381 HB_EXTERN void
318 * The resulting clusters should behave identical to pre-reordering clusters.
319 * NOTE: This has nothing to do with Unicode normalization. */
320 void
321 hb_buffer_normalize_glyphs (hb_buffer_t *buffer); 382 hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
322 383
323 384
324 /* 385 /*
325 * Serialize 386 * Serialize
326 */ 387 */
327 388
328 /* 389 /**
390 * hb_buffer_serialize_flags_t:
391 * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positi ons.
392 * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
393 * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position infor mation.
394 * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
395 * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
396 *
397 * Flags that control what glyph information are serialized in hb_buffer_seriali ze_glyphs().
398 *
329 * Since: 0.9.20 399 * Since: 0.9.20
330 */ 400 */
331 typedef enum { /*< flags >*/ 401 typedef enum { /*< flags >*/
332 HB_BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000u, 402 HB_BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000u,
333 HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001u, 403 HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001u,
334 HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u, 404 HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u,
335 HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u, 405 HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u,
336 HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u 406 HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u
337 } hb_buffer_serialize_flags_t; 407 } hb_buffer_serialize_flags_t;
338 408
409 /**
410 * hb_buffer_serialize_format_t:
411 * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
412 * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
413 * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
414 *
415 * The buffer serialization and de-serialization format used in
416 * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
417 *
418 * Since: 0.9.2
419 */
339 typedef enum { 420 typedef enum {
340 HB_BUFFER_SERIALIZE_FORMAT_TEXT = HB_TAG('T','E','X','T'), 421 HB_BUFFER_SERIALIZE_FORMAT_TEXT = HB_TAG('T','E','X','T'),
341 HB_BUFFER_SERIALIZE_FORMAT_JSON = HB_TAG('J','S','O','N'), 422 HB_BUFFER_SERIALIZE_FORMAT_JSON = HB_TAG('J','S','O','N'),
342 HB_BUFFER_SERIALIZE_FORMAT_INVALID = HB_TAG_NONE 423 HB_BUFFER_SERIALIZE_FORMAT_INVALID = HB_TAG_NONE
343 } hb_buffer_serialize_format_t; 424 } hb_buffer_serialize_format_t;
344 425
345 /* len=-1 means str is NUL-terminated. */ 426 HB_EXTERN hb_buffer_serialize_format_t
346 hb_buffer_serialize_format_t
347 hb_buffer_serialize_format_from_string (const char *str, int len); 427 hb_buffer_serialize_format_from_string (const char *str, int len);
348 428
349 const char * 429 HB_EXTERN const char *
350 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format); 430 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
351 431
352 const char ** 432 HB_EXTERN const char **
353 hb_buffer_serialize_list_formats (void); 433 hb_buffer_serialize_list_formats (void);
354 434
355 /* Returns number of items, starting at start, that were serialized. */ 435 HB_EXTERN unsigned int
356 unsigned int
357 hb_buffer_serialize_glyphs (hb_buffer_t *buffer, 436 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
358 unsigned int start, 437 unsigned int start,
359 unsigned int end, 438 unsigned int end,
360 char *buf, 439 char *buf,
361 unsigned int buf_size, 440 unsigned int buf_size,
362 » » » unsigned int *buf_consumed, /* May be NULL */ 441 » » » unsigned int *buf_consumed,
363 » » » hb_font_t *font, /* May be NULL */ 442 » » » hb_font_t *font,
364 hb_buffer_serialize_format_t format, 443 hb_buffer_serialize_format_t format,
365 hb_buffer_serialize_flags_t flags); 444 hb_buffer_serialize_flags_t flags);
366 445
367 hb_bool_t 446 HB_EXTERN hb_bool_t
368 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer, 447 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
369 const char *buf, 448 const char *buf,
370 » » » int buf_len, /* -1 means nul-terminated */ 449 » » » int buf_len,
371 » » » const char **end_ptr, /* May be NULL */ 450 » » » const char **end_ptr,
372 » » » hb_font_t *font, /* May be NULL */ 451 » » » hb_font_t *font,
373 hb_buffer_serialize_format_t format); 452 hb_buffer_serialize_format_t format);
374 453
375 454
455 /*
456 * Debugging.
457 */
458
459 typedef hb_bool_t (*hb_buffer_message_func_t) (hb_buffer_t *buffer,
460 hb_font_t *font,
461 const char *message,
462 void *user_data) ;
463
464 HB_EXTERN void
465 hb_buffer_set_message_func (hb_buffer_t *buffer,
466 hb_buffer_message_func_t func,
467 void *user_data, hb_destroy_func_t destroy);
468
469
376 HB_END_DECLS 470 HB_END_DECLS
377 471
378 #endif /* HB_BUFFER_H */ 472 #endif /* HB_BUFFER_H */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-blob.h ('k') | third_party/harfbuzz-ng/src/hb-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698