2 * Copyright © 1998-2004 David Turner and Werner Lemberg
3 * Copyright © 2004,2007,2009 Red Hat, Inc.
4 * Copyright © 2011 Google, Inc.
6 * This is part of HarfBuzz, a text shaping library.
8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the
11 * above copyright notice and the following two paragraphs appear in
12 * all copies of this software.
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
26 * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
27 * Google Author(s): Behdad Esfahbod
33 #include "hb-common.h"
34 #include "hb-unicode.h"
39 typedef struct _hb_buffer_t hb_buffer_t;
41 typedef struct _hb_glyph_info_t {
42 hb_codepoint_t codepoint;
51 typedef struct _hb_glyph_position_t {
52 hb_position_t x_advance;
53 hb_position_t y_advance;
54 hb_position_t x_offset;
55 hb_position_t y_offset;
59 } hb_glyph_position_t;
63 hb_buffer_create (unsigned int pre_alloc_size);
66 hb_buffer_get_empty (void);
69 hb_buffer_reference (hb_buffer_t *buffer);
72 hb_buffer_destroy (hb_buffer_t *buffer);
75 hb_buffer_set_user_data (hb_buffer_t *buffer,
76 hb_user_data_key_t *key,
78 hb_destroy_func_t destroy);
81 hb_buffer_get_user_data (hb_buffer_t *buffer,
82 hb_user_data_key_t *key);
86 hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
87 hb_unicode_funcs_t *unicode_funcs);
90 hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
93 hb_buffer_set_direction (hb_buffer_t *buffer,
94 hb_direction_t direction);
97 hb_buffer_get_direction (hb_buffer_t *buffer);
100 hb_buffer_set_script (hb_buffer_t *buffer,
104 hb_buffer_get_script (hb_buffer_t *buffer);
107 hb_buffer_set_language (hb_buffer_t *buffer,
108 hb_language_t language);
111 hb_buffer_get_language (hb_buffer_t *buffer);
114 /* Resets the buffer. Afterwards it's as if it was just created,
115 * except that it has a larger buffer allocated perhaps... */
117 hb_buffer_reset (hb_buffer_t *buffer);
119 /* Returns FALSE if allocation failed */
121 hb_buffer_pre_allocate (hb_buffer_t *buffer,
125 /* Returns FALSE if allocation has failed before */
127 hb_buffer_allocation_successful (hb_buffer_t *buffer);
130 hb_buffer_reverse (hb_buffer_t *buffer);
133 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
136 /* Filling the buffer in */
139 hb_buffer_add (hb_buffer_t *buffer,
140 hb_codepoint_t codepoint,
142 unsigned int cluster);
145 hb_buffer_add_utf8 (hb_buffer_t *buffer,
147 unsigned int text_length,
148 unsigned int item_offset,
149 unsigned int item_length);
152 hb_buffer_add_utf16 (hb_buffer_t *buffer,
153 const uint16_t *text,
154 unsigned int text_length,
155 unsigned int item_offset,
156 unsigned int item_length);
159 hb_buffer_add_utf32 (hb_buffer_t *buffer,
160 const uint32_t *text,
161 unsigned int text_length,
162 unsigned int item_offset,
163 unsigned int item_length);
166 /* Clears any new items added at the end */
168 hb_buffer_set_length (hb_buffer_t *buffer,
169 unsigned int length);
171 /* Return value valid as long as buffer not modified */
173 hb_buffer_get_length (hb_buffer_t *buffer);
175 /* Getting glyphs out of the buffer */
177 /* Return value valid as long as buffer not modified */
179 hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
180 unsigned int *length);
182 /* Return value valid as long as buffer not modified */
183 hb_glyph_position_t *
184 hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
185 unsigned int *length);
190 #endif /* HB_BUFFER_H */