2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2004,2007,2009 Red Hat, Inc.
5 * This is part of HarfBuzz, an OpenType Layout engine library.
7 * Permission is hereby granted, without written agreement and without
8 * license or royalty fees, to use, copy, modify, and distribute this
9 * software and its documentation for any purpose, provided that the
10 * above copyright notice and the following two paragraphs appear in
11 * all copies of this software.
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
31 #include "hb-common.h"
32 #include "hb-unicode.h"
33 #include "hb-language.h"
37 typedef struct _hb_buffer_t hb_buffer_t;
39 typedef enum _hb_direction_t {
46 typedef struct _hb_glyph_info_t {
47 hb_codepoint_t codepoint;
54 typedef struct _hb_glyph_position_t {
55 hb_position_t x_advance;
56 hb_position_t y_advance;
57 hb_position_t x_offset;
58 hb_position_t y_offset;
59 /* XXX these should all be replaced by "uint32_t internal" */
60 uint32_t new_advance :1; /* if set, the advance width values are
61 absolute, i.e., they won't be
62 added to the original glyph's value
63 but rather replace them */
64 uint32_t back : 15; /* number of glyphs to go back
65 for drawing current glyph */
66 int32_t cursive_chain : 16; /* character to which this connects,
67 may be positive or negative; used
69 } hb_glyph_position_t;
73 hb_buffer_create (unsigned int pre_alloc_size);
76 hb_buffer_reference (hb_buffer_t *buffer);
79 hb_buffer_get_reference_count (hb_buffer_t *buffer);
82 hb_buffer_destroy (hb_buffer_t *buffer);
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);
115 hb_buffer_clear (hb_buffer_t *buffer);
118 hb_buffer_clear_positions (hb_buffer_t *buffer);
121 hb_buffer_ensure (hb_buffer_t *buffer,
125 hb_buffer_reverse (hb_buffer_t *buffer);
128 /* Filling the buffer in */
131 hb_buffer_add_glyph (hb_buffer_t *buffer,
132 hb_codepoint_t codepoint,
134 unsigned int cluster);
137 hb_buffer_add_utf8 (hb_buffer_t *buffer,
139 unsigned int text_length,
140 unsigned int item_offset,
141 unsigned int item_length);
144 hb_buffer_add_utf16 (hb_buffer_t *buffer,
145 const uint16_t *text,
146 unsigned int text_length,
147 unsigned int item_offset,
148 unsigned int item_length);
151 hb_buffer_add_utf32 (hb_buffer_t *buffer,
152 const uint32_t *text,
153 unsigned int text_length,
154 unsigned int item_offset,
155 unsigned int item_length);
158 /* Getting glyphs out of the buffer */
160 /* Return value valid as long as buffer not modified */
162 hb_buffer_get_length (hb_buffer_t *buffer);
164 /* Return value valid as long as buffer not modified */
166 hb_buffer_get_glyph_infos (hb_buffer_t *buffer);
168 /* Return value valid as long as buffer not modified */
169 hb_glyph_position_t *
170 hb_buffer_get_glyph_positions (hb_buffer_t *buffer);
175 #endif /* HB_BUFFER_H */