jpayne@69
|
1 /*
|
jpayne@69
|
2 * Copyright © 1998-2004 David Turner and Werner Lemberg
|
jpayne@69
|
3 * Copyright © 2004,2007,2009 Red Hat, Inc.
|
jpayne@69
|
4 * Copyright © 2011,2012 Google, Inc.
|
jpayne@69
|
5 *
|
jpayne@69
|
6 * This is part of HarfBuzz, a text shaping library.
|
jpayne@69
|
7 *
|
jpayne@69
|
8 * Permission is hereby granted, without written agreement and without
|
jpayne@69
|
9 * license or royalty fees, to use, copy, modify, and distribute this
|
jpayne@69
|
10 * software and its documentation for any purpose, provided that the
|
jpayne@69
|
11 * above copyright notice and the following two paragraphs appear in
|
jpayne@69
|
12 * all copies of this software.
|
jpayne@69
|
13 *
|
jpayne@69
|
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
jpayne@69
|
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
jpayne@69
|
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
jpayne@69
|
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
jpayne@69
|
18 * DAMAGE.
|
jpayne@69
|
19 *
|
jpayne@69
|
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
jpayne@69
|
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
jpayne@69
|
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
jpayne@69
|
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
jpayne@69
|
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
jpayne@69
|
25 *
|
jpayne@69
|
26 * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
|
jpayne@69
|
27 * Google Author(s): Behdad Esfahbod
|
jpayne@69
|
28 */
|
jpayne@69
|
29
|
jpayne@69
|
30 #ifndef HB_H_IN
|
jpayne@69
|
31 #error "Include <hb.h> instead."
|
jpayne@69
|
32 #endif
|
jpayne@69
|
33
|
jpayne@69
|
34 #ifndef HB_BUFFER_H
|
jpayne@69
|
35 #define HB_BUFFER_H
|
jpayne@69
|
36
|
jpayne@69
|
37 #include "hb-common.h"
|
jpayne@69
|
38 #include "hb-unicode.h"
|
jpayne@69
|
39 #include "hb-font.h"
|
jpayne@69
|
40
|
jpayne@69
|
41 HB_BEGIN_DECLS
|
jpayne@69
|
42
|
jpayne@69
|
43 /**
|
jpayne@69
|
44 * hb_glyph_info_t:
|
jpayne@69
|
45 * @codepoint: either a Unicode code point (before shaping) or a glyph index
|
jpayne@69
|
46 * (after shaping).
|
jpayne@69
|
47 * @cluster: the index of the character in the original text that corresponds
|
jpayne@69
|
48 * to this #hb_glyph_info_t, or whatever the client passes to
|
jpayne@69
|
49 * hb_buffer_add(). More than one #hb_glyph_info_t can have the same
|
jpayne@69
|
50 * @cluster value, if they resulted from the same character (e.g. one
|
jpayne@69
|
51 * to many glyph substitution), and when more than one character gets
|
jpayne@69
|
52 * merged in the same glyph (e.g. many to one glyph substitution) the
|
jpayne@69
|
53 * #hb_glyph_info_t will have the smallest cluster value of them.
|
jpayne@69
|
54 * By default some characters are merged into the same cluster
|
jpayne@69
|
55 * (e.g. combining marks have the same cluster as their bases)
|
jpayne@69
|
56 * even if they are separate glyphs, hb_buffer_set_cluster_level()
|
jpayne@69
|
57 * allow selecting more fine-grained cluster handling.
|
jpayne@69
|
58 *
|
jpayne@69
|
59 * The #hb_glyph_info_t is the structure that holds information about the
|
jpayne@69
|
60 * glyphs and their relation to input text.
|
jpayne@69
|
61 */
|
jpayne@69
|
62 typedef struct hb_glyph_info_t
|
jpayne@69
|
63 {
|
jpayne@69
|
64 hb_codepoint_t codepoint;
|
jpayne@69
|
65 /*< private >*/
|
jpayne@69
|
66 hb_mask_t mask;
|
jpayne@69
|
67 /*< public >*/
|
jpayne@69
|
68 uint32_t cluster;
|
jpayne@69
|
69
|
jpayne@69
|
70 /*< private >*/
|
jpayne@69
|
71 hb_var_int_t var1;
|
jpayne@69
|
72 hb_var_int_t var2;
|
jpayne@69
|
73 } hb_glyph_info_t;
|
jpayne@69
|
74
|
jpayne@69
|
75 /**
|
jpayne@69
|
76 * hb_glyph_flags_t:
|
jpayne@69
|
77 * @HB_GLYPH_FLAG_UNSAFE_TO_BREAK: Indicates that if input text is broken at the
|
jpayne@69
|
78 * beginning of the cluster this glyph is part of,
|
jpayne@69
|
79 * then both sides need to be re-shaped, as the
|
jpayne@69
|
80 * result might be different. On the flip side,
|
jpayne@69
|
81 * it means that when this flag is not present,
|
jpayne@69
|
82 * then it's safe to break the glyph-run at the
|
jpayne@69
|
83 * beginning of this cluster, and the two sides
|
jpayne@69
|
84 * represent the exact same result one would get
|
jpayne@69
|
85 * if breaking input text at the beginning of
|
jpayne@69
|
86 * this cluster and shaping the two sides
|
jpayne@69
|
87 * separately. This can be used to optimize
|
jpayne@69
|
88 * paragraph layout, by avoiding re-shaping
|
jpayne@69
|
89 * of each line after line-breaking, or limiting
|
jpayne@69
|
90 * the reshaping to a small piece around the
|
jpayne@69
|
91 * breaking point only.
|
jpayne@69
|
92 * @HB_GLYPH_FLAG_DEFINED: All the currently defined flags.
|
jpayne@69
|
93 *
|
jpayne@69
|
94 * Since: 1.5.0
|
jpayne@69
|
95 */
|
jpayne@69
|
96 typedef enum { /*< flags >*/
|
jpayne@69
|
97 HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001,
|
jpayne@69
|
98
|
jpayne@69
|
99 HB_GLYPH_FLAG_DEFINED = 0x00000001 /* OR of all defined flags */
|
jpayne@69
|
100 } hb_glyph_flags_t;
|
jpayne@69
|
101
|
jpayne@69
|
102 HB_EXTERN hb_glyph_flags_t
|
jpayne@69
|
103 hb_glyph_info_get_glyph_flags (const hb_glyph_info_t *info);
|
jpayne@69
|
104
|
jpayne@69
|
105 #define hb_glyph_info_get_glyph_flags(info) \
|
jpayne@69
|
106 ((hb_glyph_flags_t) ((unsigned int) (info)->mask & HB_GLYPH_FLAG_DEFINED))
|
jpayne@69
|
107
|
jpayne@69
|
108
|
jpayne@69
|
109 /**
|
jpayne@69
|
110 * hb_glyph_position_t:
|
jpayne@69
|
111 * @x_advance: how much the line advances after drawing this glyph when setting
|
jpayne@69
|
112 * text in horizontal direction.
|
jpayne@69
|
113 * @y_advance: how much the line advances after drawing this glyph when setting
|
jpayne@69
|
114 * text in vertical direction.
|
jpayne@69
|
115 * @x_offset: how much the glyph moves on the X-axis before drawing it, this
|
jpayne@69
|
116 * should not affect how much the line advances.
|
jpayne@69
|
117 * @y_offset: how much the glyph moves on the Y-axis before drawing it, this
|
jpayne@69
|
118 * should not affect how much the line advances.
|
jpayne@69
|
119 *
|
jpayne@69
|
120 * The #hb_glyph_position_t is the structure that holds the positions of the
|
jpayne@69
|
121 * glyph in both horizontal and vertical directions. All positions in
|
jpayne@69
|
122 * #hb_glyph_position_t are relative to the current point.
|
jpayne@69
|
123 *
|
jpayne@69
|
124 */
|
jpayne@69
|
125 typedef struct hb_glyph_position_t {
|
jpayne@69
|
126 hb_position_t x_advance;
|
jpayne@69
|
127 hb_position_t y_advance;
|
jpayne@69
|
128 hb_position_t x_offset;
|
jpayne@69
|
129 hb_position_t y_offset;
|
jpayne@69
|
130
|
jpayne@69
|
131 /*< private >*/
|
jpayne@69
|
132 hb_var_int_t var;
|
jpayne@69
|
133 } hb_glyph_position_t;
|
jpayne@69
|
134
|
jpayne@69
|
135 /**
|
jpayne@69
|
136 * hb_segment_properties_t:
|
jpayne@69
|
137 * @direction: the #hb_direction_t of the buffer, see hb_buffer_set_direction().
|
jpayne@69
|
138 * @script: the #hb_script_t of the buffer, see hb_buffer_set_script().
|
jpayne@69
|
139 * @language: the #hb_language_t of the buffer, see hb_buffer_set_language().
|
jpayne@69
|
140 *
|
jpayne@69
|
141 * The structure that holds various text properties of an #hb_buffer_t. Can be
|
jpayne@69
|
142 * set and retrieved using hb_buffer_set_segment_properties() and
|
jpayne@69
|
143 * hb_buffer_get_segment_properties(), respectively.
|
jpayne@69
|
144 */
|
jpayne@69
|
145 typedef struct hb_segment_properties_t {
|
jpayne@69
|
146 hb_direction_t direction;
|
jpayne@69
|
147 hb_script_t script;
|
jpayne@69
|
148 hb_language_t language;
|
jpayne@69
|
149 /*< private >*/
|
jpayne@69
|
150 void *reserved1;
|
jpayne@69
|
151 void *reserved2;
|
jpayne@69
|
152 } hb_segment_properties_t;
|
jpayne@69
|
153
|
jpayne@69
|
154 #define HB_SEGMENT_PROPERTIES_DEFAULT {HB_DIRECTION_INVALID, \
|
jpayne@69
|
155 HB_SCRIPT_INVALID, \
|
jpayne@69
|
156 HB_LANGUAGE_INVALID, \
|
jpayne@69
|
157 (void *) 0, \
|
jpayne@69
|
158 (void *) 0}
|
jpayne@69
|
159
|
jpayne@69
|
160 HB_EXTERN hb_bool_t
|
jpayne@69
|
161 hb_segment_properties_equal (const hb_segment_properties_t *a,
|
jpayne@69
|
162 const hb_segment_properties_t *b);
|
jpayne@69
|
163
|
jpayne@69
|
164 HB_EXTERN unsigned int
|
jpayne@69
|
165 hb_segment_properties_hash (const hb_segment_properties_t *p);
|
jpayne@69
|
166
|
jpayne@69
|
167
|
jpayne@69
|
168
|
jpayne@69
|
169 /**
|
jpayne@69
|
170 * hb_buffer_t:
|
jpayne@69
|
171 *
|
jpayne@69
|
172 * The main structure holding the input text and its properties before shaping,
|
jpayne@69
|
173 * and output glyphs and their information after shaping.
|
jpayne@69
|
174 */
|
jpayne@69
|
175
|
jpayne@69
|
176 typedef struct hb_buffer_t hb_buffer_t;
|
jpayne@69
|
177
|
jpayne@69
|
178 HB_EXTERN hb_buffer_t *
|
jpayne@69
|
179 hb_buffer_create (void);
|
jpayne@69
|
180
|
jpayne@69
|
181 HB_EXTERN hb_buffer_t *
|
jpayne@69
|
182 hb_buffer_get_empty (void);
|
jpayne@69
|
183
|
jpayne@69
|
184 HB_EXTERN hb_buffer_t *
|
jpayne@69
|
185 hb_buffer_reference (hb_buffer_t *buffer);
|
jpayne@69
|
186
|
jpayne@69
|
187 HB_EXTERN void
|
jpayne@69
|
188 hb_buffer_destroy (hb_buffer_t *buffer);
|
jpayne@69
|
189
|
jpayne@69
|
190 HB_EXTERN hb_bool_t
|
jpayne@69
|
191 hb_buffer_set_user_data (hb_buffer_t *buffer,
|
jpayne@69
|
192 hb_user_data_key_t *key,
|
jpayne@69
|
193 void * data,
|
jpayne@69
|
194 hb_destroy_func_t destroy,
|
jpayne@69
|
195 hb_bool_t replace);
|
jpayne@69
|
196
|
jpayne@69
|
197 HB_EXTERN void *
|
jpayne@69
|
198 hb_buffer_get_user_data (hb_buffer_t *buffer,
|
jpayne@69
|
199 hb_user_data_key_t *key);
|
jpayne@69
|
200
|
jpayne@69
|
201
|
jpayne@69
|
202 /**
|
jpayne@69
|
203 * hb_buffer_content_type_t:
|
jpayne@69
|
204 * @HB_BUFFER_CONTENT_TYPE_INVALID: Initial value for new buffer.
|
jpayne@69
|
205 * @HB_BUFFER_CONTENT_TYPE_UNICODE: The buffer contains input characters (before shaping).
|
jpayne@69
|
206 * @HB_BUFFER_CONTENT_TYPE_GLYPHS: The buffer contains output glyphs (after shaping).
|
jpayne@69
|
207 */
|
jpayne@69
|
208 typedef enum {
|
jpayne@69
|
209 HB_BUFFER_CONTENT_TYPE_INVALID = 0,
|
jpayne@69
|
210 HB_BUFFER_CONTENT_TYPE_UNICODE,
|
jpayne@69
|
211 HB_BUFFER_CONTENT_TYPE_GLYPHS
|
jpayne@69
|
212 } hb_buffer_content_type_t;
|
jpayne@69
|
213
|
jpayne@69
|
214 HB_EXTERN void
|
jpayne@69
|
215 hb_buffer_set_content_type (hb_buffer_t *buffer,
|
jpayne@69
|
216 hb_buffer_content_type_t content_type);
|
jpayne@69
|
217
|
jpayne@69
|
218 HB_EXTERN hb_buffer_content_type_t
|
jpayne@69
|
219 hb_buffer_get_content_type (hb_buffer_t *buffer);
|
jpayne@69
|
220
|
jpayne@69
|
221
|
jpayne@69
|
222 HB_EXTERN void
|
jpayne@69
|
223 hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
|
jpayne@69
|
224 hb_unicode_funcs_t *unicode_funcs);
|
jpayne@69
|
225
|
jpayne@69
|
226 HB_EXTERN hb_unicode_funcs_t *
|
jpayne@69
|
227 hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
|
jpayne@69
|
228
|
jpayne@69
|
229 HB_EXTERN void
|
jpayne@69
|
230 hb_buffer_set_direction (hb_buffer_t *buffer,
|
jpayne@69
|
231 hb_direction_t direction);
|
jpayne@69
|
232
|
jpayne@69
|
233 HB_EXTERN hb_direction_t
|
jpayne@69
|
234 hb_buffer_get_direction (hb_buffer_t *buffer);
|
jpayne@69
|
235
|
jpayne@69
|
236 HB_EXTERN void
|
jpayne@69
|
237 hb_buffer_set_script (hb_buffer_t *buffer,
|
jpayne@69
|
238 hb_script_t script);
|
jpayne@69
|
239
|
jpayne@69
|
240 HB_EXTERN hb_script_t
|
jpayne@69
|
241 hb_buffer_get_script (hb_buffer_t *buffer);
|
jpayne@69
|
242
|
jpayne@69
|
243 HB_EXTERN void
|
jpayne@69
|
244 hb_buffer_set_language (hb_buffer_t *buffer,
|
jpayne@69
|
245 hb_language_t language);
|
jpayne@69
|
246
|
jpayne@69
|
247
|
jpayne@69
|
248 HB_EXTERN hb_language_t
|
jpayne@69
|
249 hb_buffer_get_language (hb_buffer_t *buffer);
|
jpayne@69
|
250
|
jpayne@69
|
251 HB_EXTERN void
|
jpayne@69
|
252 hb_buffer_set_segment_properties (hb_buffer_t *buffer,
|
jpayne@69
|
253 const hb_segment_properties_t *props);
|
jpayne@69
|
254
|
jpayne@69
|
255 HB_EXTERN void
|
jpayne@69
|
256 hb_buffer_get_segment_properties (hb_buffer_t *buffer,
|
jpayne@69
|
257 hb_segment_properties_t *props);
|
jpayne@69
|
258
|
jpayne@69
|
259 HB_EXTERN void
|
jpayne@69
|
260 hb_buffer_guess_segment_properties (hb_buffer_t *buffer);
|
jpayne@69
|
261
|
jpayne@69
|
262
|
jpayne@69
|
263 /**
|
jpayne@69
|
264 * hb_buffer_flags_t:
|
jpayne@69
|
265 * @HB_BUFFER_FLAG_DEFAULT: the default buffer flag.
|
jpayne@69
|
266 * @HB_BUFFER_FLAG_BOT: flag indicating that special handling of the beginning
|
jpayne@69
|
267 * of text paragraph can be applied to this buffer. Should usually
|
jpayne@69
|
268 * be set, unless you are passing to the buffer only part
|
jpayne@69
|
269 * of the text without the full context.
|
jpayne@69
|
270 * @HB_BUFFER_FLAG_EOT: flag indicating that special handling of the end of text
|
jpayne@69
|
271 * paragraph can be applied to this buffer, similar to
|
jpayne@69
|
272 * @HB_BUFFER_FLAG_BOT.
|
jpayne@69
|
273 * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES:
|
jpayne@69
|
274 * flag indication that character with Default_Ignorable
|
jpayne@69
|
275 * Unicode property should use the corresponding glyph
|
jpayne@69
|
276 * from the font, instead of hiding them (done by
|
jpayne@69
|
277 * replacing them with the space glyph and zeroing the
|
jpayne@69
|
278 * advance width.) This flag takes precedence over
|
jpayne@69
|
279 * @HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES.
|
jpayne@69
|
280 * @HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES:
|
jpayne@69
|
281 * flag indication that character with Default_Ignorable
|
jpayne@69
|
282 * Unicode property should be removed from glyph string
|
jpayne@69
|
283 * instead of hiding them (done by replacing them with the
|
jpayne@69
|
284 * space glyph and zeroing the advance width.)
|
jpayne@69
|
285 * @HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES takes
|
jpayne@69
|
286 * precedence over this flag. Since: 1.8.0
|
jpayne@69
|
287 * @HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE:
|
jpayne@69
|
288 * flag indicating that a dotted circle should
|
jpayne@69
|
289 * not be inserted in the rendering of incorrect
|
jpayne@69
|
290 * character sequences (such at <0905 093E>). Since: 2.4
|
jpayne@69
|
291 *
|
jpayne@69
|
292 * Since: 0.9.20
|
jpayne@69
|
293 */
|
jpayne@69
|
294 typedef enum { /*< flags >*/
|
jpayne@69
|
295 HB_BUFFER_FLAG_DEFAULT = 0x00000000u,
|
jpayne@69
|
296 HB_BUFFER_FLAG_BOT = 0x00000001u, /* Beginning-of-text */
|
jpayne@69
|
297 HB_BUFFER_FLAG_EOT = 0x00000002u, /* End-of-text */
|
jpayne@69
|
298 HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES = 0x00000004u,
|
jpayne@69
|
299 HB_BUFFER_FLAG_REMOVE_DEFAULT_IGNORABLES = 0x00000008u,
|
jpayne@69
|
300 HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE = 0x00000010u
|
jpayne@69
|
301 } hb_buffer_flags_t;
|
jpayne@69
|
302
|
jpayne@69
|
303 HB_EXTERN void
|
jpayne@69
|
304 hb_buffer_set_flags (hb_buffer_t *buffer,
|
jpayne@69
|
305 hb_buffer_flags_t flags);
|
jpayne@69
|
306
|
jpayne@69
|
307 HB_EXTERN hb_buffer_flags_t
|
jpayne@69
|
308 hb_buffer_get_flags (hb_buffer_t *buffer);
|
jpayne@69
|
309
|
jpayne@69
|
310 /**
|
jpayne@69
|
311 * hb_buffer_cluster_level_t:
|
jpayne@69
|
312 * @HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES: Return cluster values grouped by graphemes into
|
jpayne@69
|
313 * monotone order.
|
jpayne@69
|
314 * @HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS: Return cluster values grouped into monotone order.
|
jpayne@69
|
315 * @HB_BUFFER_CLUSTER_LEVEL_CHARACTERS: Don't group cluster values.
|
jpayne@69
|
316 * @HB_BUFFER_CLUSTER_LEVEL_DEFAULT: Default cluster level,
|
jpayne@69
|
317 * equal to @HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES.
|
jpayne@69
|
318 *
|
jpayne@69
|
319 * Since: 0.9.42
|
jpayne@69
|
320 */
|
jpayne@69
|
321 typedef enum {
|
jpayne@69
|
322 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = 0,
|
jpayne@69
|
323 HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = 1,
|
jpayne@69
|
324 HB_BUFFER_CLUSTER_LEVEL_CHARACTERS = 2,
|
jpayne@69
|
325 HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES
|
jpayne@69
|
326 } hb_buffer_cluster_level_t;
|
jpayne@69
|
327
|
jpayne@69
|
328 HB_EXTERN void
|
jpayne@69
|
329 hb_buffer_set_cluster_level (hb_buffer_t *buffer,
|
jpayne@69
|
330 hb_buffer_cluster_level_t cluster_level);
|
jpayne@69
|
331
|
jpayne@69
|
332 HB_EXTERN hb_buffer_cluster_level_t
|
jpayne@69
|
333 hb_buffer_get_cluster_level (hb_buffer_t *buffer);
|
jpayne@69
|
334
|
jpayne@69
|
335 /**
|
jpayne@69
|
336 * HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT:
|
jpayne@69
|
337 *
|
jpayne@69
|
338 * The default code point for replacing invalid characters in a given encoding.
|
jpayne@69
|
339 * Set to U+FFFD REPLACEMENT CHARACTER.
|
jpayne@69
|
340 *
|
jpayne@69
|
341 * Since: 0.9.31
|
jpayne@69
|
342 */
|
jpayne@69
|
343 #define HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT 0xFFFDu
|
jpayne@69
|
344
|
jpayne@69
|
345 HB_EXTERN void
|
jpayne@69
|
346 hb_buffer_set_replacement_codepoint (hb_buffer_t *buffer,
|
jpayne@69
|
347 hb_codepoint_t replacement);
|
jpayne@69
|
348
|
jpayne@69
|
349 HB_EXTERN hb_codepoint_t
|
jpayne@69
|
350 hb_buffer_get_replacement_codepoint (hb_buffer_t *buffer);
|
jpayne@69
|
351
|
jpayne@69
|
352 HB_EXTERN void
|
jpayne@69
|
353 hb_buffer_set_invisible_glyph (hb_buffer_t *buffer,
|
jpayne@69
|
354 hb_codepoint_t invisible);
|
jpayne@69
|
355
|
jpayne@69
|
356 HB_EXTERN hb_codepoint_t
|
jpayne@69
|
357 hb_buffer_get_invisible_glyph (hb_buffer_t *buffer);
|
jpayne@69
|
358
|
jpayne@69
|
359
|
jpayne@69
|
360 HB_EXTERN void
|
jpayne@69
|
361 hb_buffer_reset (hb_buffer_t *buffer);
|
jpayne@69
|
362
|
jpayne@69
|
363 HB_EXTERN void
|
jpayne@69
|
364 hb_buffer_clear_contents (hb_buffer_t *buffer);
|
jpayne@69
|
365
|
jpayne@69
|
366 HB_EXTERN hb_bool_t
|
jpayne@69
|
367 hb_buffer_pre_allocate (hb_buffer_t *buffer,
|
jpayne@69
|
368 unsigned int size);
|
jpayne@69
|
369
|
jpayne@69
|
370
|
jpayne@69
|
371 HB_EXTERN hb_bool_t
|
jpayne@69
|
372 hb_buffer_allocation_successful (hb_buffer_t *buffer);
|
jpayne@69
|
373
|
jpayne@69
|
374 HB_EXTERN void
|
jpayne@69
|
375 hb_buffer_reverse (hb_buffer_t *buffer);
|
jpayne@69
|
376
|
jpayne@69
|
377 HB_EXTERN void
|
jpayne@69
|
378 hb_buffer_reverse_range (hb_buffer_t *buffer,
|
jpayne@69
|
379 unsigned int start, unsigned int end);
|
jpayne@69
|
380
|
jpayne@69
|
381 HB_EXTERN void
|
jpayne@69
|
382 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
|
jpayne@69
|
383
|
jpayne@69
|
384
|
jpayne@69
|
385 /* Filling the buffer in */
|
jpayne@69
|
386
|
jpayne@69
|
387 HB_EXTERN void
|
jpayne@69
|
388 hb_buffer_add (hb_buffer_t *buffer,
|
jpayne@69
|
389 hb_codepoint_t codepoint,
|
jpayne@69
|
390 unsigned int cluster);
|
jpayne@69
|
391
|
jpayne@69
|
392 HB_EXTERN void
|
jpayne@69
|
393 hb_buffer_add_utf8 (hb_buffer_t *buffer,
|
jpayne@69
|
394 const char *text,
|
jpayne@69
|
395 int text_length,
|
jpayne@69
|
396 unsigned int item_offset,
|
jpayne@69
|
397 int item_length);
|
jpayne@69
|
398
|
jpayne@69
|
399 HB_EXTERN void
|
jpayne@69
|
400 hb_buffer_add_utf16 (hb_buffer_t *buffer,
|
jpayne@69
|
401 const uint16_t *text,
|
jpayne@69
|
402 int text_length,
|
jpayne@69
|
403 unsigned int item_offset,
|
jpayne@69
|
404 int item_length);
|
jpayne@69
|
405
|
jpayne@69
|
406 HB_EXTERN void
|
jpayne@69
|
407 hb_buffer_add_utf32 (hb_buffer_t *buffer,
|
jpayne@69
|
408 const uint32_t *text,
|
jpayne@69
|
409 int text_length,
|
jpayne@69
|
410 unsigned int item_offset,
|
jpayne@69
|
411 int item_length);
|
jpayne@69
|
412
|
jpayne@69
|
413 HB_EXTERN void
|
jpayne@69
|
414 hb_buffer_add_latin1 (hb_buffer_t *buffer,
|
jpayne@69
|
415 const uint8_t *text,
|
jpayne@69
|
416 int text_length,
|
jpayne@69
|
417 unsigned int item_offset,
|
jpayne@69
|
418 int item_length);
|
jpayne@69
|
419
|
jpayne@69
|
420 HB_EXTERN void
|
jpayne@69
|
421 hb_buffer_add_codepoints (hb_buffer_t *buffer,
|
jpayne@69
|
422 const hb_codepoint_t *text,
|
jpayne@69
|
423 int text_length,
|
jpayne@69
|
424 unsigned int item_offset,
|
jpayne@69
|
425 int item_length);
|
jpayne@69
|
426
|
jpayne@69
|
427 HB_EXTERN void
|
jpayne@69
|
428 hb_buffer_append (hb_buffer_t *buffer,
|
jpayne@69
|
429 hb_buffer_t *source,
|
jpayne@69
|
430 unsigned int start,
|
jpayne@69
|
431 unsigned int end);
|
jpayne@69
|
432
|
jpayne@69
|
433 HB_EXTERN hb_bool_t
|
jpayne@69
|
434 hb_buffer_set_length (hb_buffer_t *buffer,
|
jpayne@69
|
435 unsigned int length);
|
jpayne@69
|
436
|
jpayne@69
|
437 HB_EXTERN unsigned int
|
jpayne@69
|
438 hb_buffer_get_length (hb_buffer_t *buffer);
|
jpayne@69
|
439
|
jpayne@69
|
440 /* Getting glyphs out of the buffer */
|
jpayne@69
|
441
|
jpayne@69
|
442 HB_EXTERN hb_glyph_info_t *
|
jpayne@69
|
443 hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
|
jpayne@69
|
444 unsigned int *length);
|
jpayne@69
|
445
|
jpayne@69
|
446 HB_EXTERN hb_glyph_position_t *
|
jpayne@69
|
447 hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
|
jpayne@69
|
448 unsigned int *length);
|
jpayne@69
|
449
|
jpayne@69
|
450
|
jpayne@69
|
451 HB_EXTERN void
|
jpayne@69
|
452 hb_buffer_normalize_glyphs (hb_buffer_t *buffer);
|
jpayne@69
|
453
|
jpayne@69
|
454
|
jpayne@69
|
455 /*
|
jpayne@69
|
456 * Serialize
|
jpayne@69
|
457 */
|
jpayne@69
|
458
|
jpayne@69
|
459 /**
|
jpayne@69
|
460 * hb_buffer_serialize_flags_t:
|
jpayne@69
|
461 * @HB_BUFFER_SERIALIZE_FLAG_DEFAULT: serialize glyph names, clusters and positions.
|
jpayne@69
|
462 * @HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS: do not serialize glyph cluster.
|
jpayne@69
|
463 * @HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS: do not serialize glyph position information.
|
jpayne@69
|
464 * @HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES: do no serialize glyph name.
|
jpayne@69
|
465 * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS: serialize glyph extents.
|
jpayne@69
|
466 * @HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS: serialize glyph flags. Since: 1.5.0
|
jpayne@69
|
467 * @HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES: do not serialize glyph advances,
|
jpayne@69
|
468 * glyph offsets will reflect absolute glyph positions. Since: 1.8.0
|
jpayne@69
|
469 *
|
jpayne@69
|
470 * Flags that control what glyph information are serialized in hb_buffer_serialize_glyphs().
|
jpayne@69
|
471 *
|
jpayne@69
|
472 * Since: 0.9.20
|
jpayne@69
|
473 */
|
jpayne@69
|
474 typedef enum { /*< flags >*/
|
jpayne@69
|
475 HB_BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000u,
|
jpayne@69
|
476 HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001u,
|
jpayne@69
|
477 HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u,
|
jpayne@69
|
478 HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u,
|
jpayne@69
|
479 HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u,
|
jpayne@69
|
480 HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010u,
|
jpayne@69
|
481 HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES = 0x00000020u
|
jpayne@69
|
482 } hb_buffer_serialize_flags_t;
|
jpayne@69
|
483
|
jpayne@69
|
484 /**
|
jpayne@69
|
485 * hb_buffer_serialize_format_t:
|
jpayne@69
|
486 * @HB_BUFFER_SERIALIZE_FORMAT_TEXT: a human-readable, plain text format.
|
jpayne@69
|
487 * @HB_BUFFER_SERIALIZE_FORMAT_JSON: a machine-readable JSON format.
|
jpayne@69
|
488 * @HB_BUFFER_SERIALIZE_FORMAT_INVALID: invalid format.
|
jpayne@69
|
489 *
|
jpayne@69
|
490 * The buffer serialization and de-serialization format used in
|
jpayne@69
|
491 * hb_buffer_serialize_glyphs() and hb_buffer_deserialize_glyphs().
|
jpayne@69
|
492 *
|
jpayne@69
|
493 * Since: 0.9.2
|
jpayne@69
|
494 */
|
jpayne@69
|
495 typedef enum {
|
jpayne@69
|
496 HB_BUFFER_SERIALIZE_FORMAT_TEXT = HB_TAG('T','E','X','T'),
|
jpayne@69
|
497 HB_BUFFER_SERIALIZE_FORMAT_JSON = HB_TAG('J','S','O','N'),
|
jpayne@69
|
498 HB_BUFFER_SERIALIZE_FORMAT_INVALID = HB_TAG_NONE
|
jpayne@69
|
499 } hb_buffer_serialize_format_t;
|
jpayne@69
|
500
|
jpayne@69
|
501 HB_EXTERN hb_buffer_serialize_format_t
|
jpayne@69
|
502 hb_buffer_serialize_format_from_string (const char *str, int len);
|
jpayne@69
|
503
|
jpayne@69
|
504 HB_EXTERN const char *
|
jpayne@69
|
505 hb_buffer_serialize_format_to_string (hb_buffer_serialize_format_t format);
|
jpayne@69
|
506
|
jpayne@69
|
507 HB_EXTERN const char **
|
jpayne@69
|
508 hb_buffer_serialize_list_formats (void);
|
jpayne@69
|
509
|
jpayne@69
|
510 HB_EXTERN unsigned int
|
jpayne@69
|
511 hb_buffer_serialize_glyphs (hb_buffer_t *buffer,
|
jpayne@69
|
512 unsigned int start,
|
jpayne@69
|
513 unsigned int end,
|
jpayne@69
|
514 char *buf,
|
jpayne@69
|
515 unsigned int buf_size,
|
jpayne@69
|
516 unsigned int *buf_consumed,
|
jpayne@69
|
517 hb_font_t *font,
|
jpayne@69
|
518 hb_buffer_serialize_format_t format,
|
jpayne@69
|
519 hb_buffer_serialize_flags_t flags);
|
jpayne@69
|
520
|
jpayne@69
|
521 HB_EXTERN hb_bool_t
|
jpayne@69
|
522 hb_buffer_deserialize_glyphs (hb_buffer_t *buffer,
|
jpayne@69
|
523 const char *buf,
|
jpayne@69
|
524 int buf_len,
|
jpayne@69
|
525 const char **end_ptr,
|
jpayne@69
|
526 hb_font_t *font,
|
jpayne@69
|
527 hb_buffer_serialize_format_t format);
|
jpayne@69
|
528
|
jpayne@69
|
529
|
jpayne@69
|
530 /*
|
jpayne@69
|
531 * Compare buffers
|
jpayne@69
|
532 */
|
jpayne@69
|
533
|
jpayne@69
|
534 typedef enum { /*< flags >*/
|
jpayne@69
|
535 HB_BUFFER_DIFF_FLAG_EQUAL = 0x0000,
|
jpayne@69
|
536
|
jpayne@69
|
537 /* Buffers with different content_type cannot be meaningfully compared
|
jpayne@69
|
538 * in any further detail. */
|
jpayne@69
|
539 HB_BUFFER_DIFF_FLAG_CONTENT_TYPE_MISMATCH = 0x0001,
|
jpayne@69
|
540
|
jpayne@69
|
541 /* For buffers with differing length, the per-glyph comparison is not
|
jpayne@69
|
542 * attempted, though we do still scan reference for dottedcircle / .notdef
|
jpayne@69
|
543 * glyphs. */
|
jpayne@69
|
544 HB_BUFFER_DIFF_FLAG_LENGTH_MISMATCH = 0x0002,
|
jpayne@69
|
545
|
jpayne@69
|
546 /* We want to know if dottedcircle / .notdef glyphs are present in the
|
jpayne@69
|
547 * reference, as we may not care so much about other differences in this
|
jpayne@69
|
548 * case. */
|
jpayne@69
|
549 HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT = 0x0004,
|
jpayne@69
|
550 HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT = 0x0008,
|
jpayne@69
|
551
|
jpayne@69
|
552 /* If the buffers have the same length, we compare them glyph-by-glyph
|
jpayne@69
|
553 * and report which aspect(s) of the glyph info/position are different. */
|
jpayne@69
|
554 HB_BUFFER_DIFF_FLAG_CODEPOINT_MISMATCH = 0x0010,
|
jpayne@69
|
555 HB_BUFFER_DIFF_FLAG_CLUSTER_MISMATCH = 0x0020,
|
jpayne@69
|
556 HB_BUFFER_DIFF_FLAG_GLYPH_FLAGS_MISMATCH = 0x0040,
|
jpayne@69
|
557 HB_BUFFER_DIFF_FLAG_POSITION_MISMATCH = 0x0080
|
jpayne@69
|
558
|
jpayne@69
|
559 } hb_buffer_diff_flags_t;
|
jpayne@69
|
560
|
jpayne@69
|
561 /* Compare the contents of two buffers, report types of differences. */
|
jpayne@69
|
562 HB_EXTERN hb_buffer_diff_flags_t
|
jpayne@69
|
563 hb_buffer_diff (hb_buffer_t *buffer,
|
jpayne@69
|
564 hb_buffer_t *reference,
|
jpayne@69
|
565 hb_codepoint_t dottedcircle_glyph,
|
jpayne@69
|
566 unsigned int position_fuzz);
|
jpayne@69
|
567
|
jpayne@69
|
568
|
jpayne@69
|
569 /*
|
jpayne@69
|
570 * Debugging.
|
jpayne@69
|
571 */
|
jpayne@69
|
572
|
jpayne@69
|
573 typedef hb_bool_t (*hb_buffer_message_func_t) (hb_buffer_t *buffer,
|
jpayne@69
|
574 hb_font_t *font,
|
jpayne@69
|
575 const char *message,
|
jpayne@69
|
576 void *user_data);
|
jpayne@69
|
577
|
jpayne@69
|
578 HB_EXTERN void
|
jpayne@69
|
579 hb_buffer_set_message_func (hb_buffer_t *buffer,
|
jpayne@69
|
580 hb_buffer_message_func_t func,
|
jpayne@69
|
581 void *user_data, hb_destroy_func_t destroy);
|
jpayne@69
|
582
|
jpayne@69
|
583
|
jpayne@69
|
584 HB_END_DECLS
|
jpayne@69
|
585
|
jpayne@69
|
586 #endif /* HB_BUFFER_H */
|