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_reference (hb_buffer_t *buffer);
69 hb_buffer_destroy (hb_buffer_t *buffer);
73 hb_buffer_set_unicode_funcs (hb_buffer_t *buffer,
74 hb_unicode_funcs_t *unicode_funcs);
77 hb_buffer_get_unicode_funcs (hb_buffer_t *buffer);
80 hb_buffer_set_direction (hb_buffer_t *buffer,
81 hb_direction_t direction);
84 hb_buffer_get_direction (hb_buffer_t *buffer);
87 hb_buffer_set_script (hb_buffer_t *buffer,
91 hb_buffer_get_script (hb_buffer_t *buffer);
94 hb_buffer_set_language (hb_buffer_t *buffer,
95 hb_language_t language);
98 hb_buffer_get_language (hb_buffer_t *buffer);
101 /* Resets the buffer. Afterwards it's as if it was just created,
102 * except that it has a larger buffer allocated perhaps... */
104 hb_buffer_reset (hb_buffer_t *buffer);
106 /* Returns FALSE if allocation failed */
108 hb_buffer_pre_allocate (hb_buffer_t *buffer,
112 /* Returns FALSE if allocation has failed before */
114 hb_buffer_allocation_successful (hb_buffer_t *buffer);
117 hb_buffer_reverse (hb_buffer_t *buffer);
120 hb_buffer_reverse_clusters (hb_buffer_t *buffer);
123 /* Filling the buffer in */
126 hb_buffer_add (hb_buffer_t *buffer,
127 hb_codepoint_t codepoint,
129 unsigned int cluster);
132 hb_buffer_add_utf8 (hb_buffer_t *buffer,
134 unsigned int text_length,
135 unsigned int item_offset,
136 unsigned int item_length);
139 hb_buffer_add_utf16 (hb_buffer_t *buffer,
140 const uint16_t *text,
141 unsigned int text_length,
142 unsigned int item_offset,
143 unsigned int item_length);
146 hb_buffer_add_utf32 (hb_buffer_t *buffer,
147 const uint32_t *text,
148 unsigned int text_length,
149 unsigned int item_offset,
150 unsigned int item_length);
153 /* Clears any new items added at the end */
155 hb_buffer_set_length (hb_buffer_t *buffer,
156 unsigned int length);
158 /* Return value valid as long as buffer not modified */
160 hb_buffer_get_length (hb_buffer_t *buffer);
162 /* Getting glyphs out of the buffer */
164 /* Return value valid as long as buffer not modified */
166 hb_buffer_get_glyph_infos (hb_buffer_t *buffer,
167 unsigned int *length);
169 /* Return value valid as long as buffer not modified */
170 hb_glyph_position_t *
171 hb_buffer_get_glyph_positions (hb_buffer_t *buffer,
172 unsigned int *length);
177 #endif /* HB_BUFFER_H */