2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2004,2007,2009,2010 Red Hat, Inc.
5 * This is part of HarfBuzz, a text shaping 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
28 #ifndef HB_BUFFER_PRIVATE_HH
29 #define HB_BUFFER_PRIVATE_HH
31 #include "hb-private.h"
32 #include "hb-buffer.h"
33 #include "hb-unicode-private.h"
39 #define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
40 #define gproperty() var2.u32
42 ASSERT_STATIC (sizeof (hb_glyph_info_t) == 20);
43 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
45 typedef struct _hb_segment_properties_t {
46 hb_direction_t direction;
48 hb_language_t language;
49 } hb_segment_properties_t;
53 _hb_buffer_swap (hb_buffer_t *buffer);
56 _hb_buffer_clear_output (hb_buffer_t *buffer);
59 _hb_buffer_replace_glyphs (hb_buffer_t *buffer,
62 const hb_codepoint_t *glyph_data);
65 _hb_buffer_replace_glyphs_be16 (hb_buffer_t *buffer,
68 const uint16_t *glyph_data_be);
71 _hb_buffer_replace_glyph (hb_buffer_t *buffer,
72 hb_codepoint_t glyph_index);
75 _hb_buffer_next_glyph (hb_buffer_t *buffer);
79 _hb_buffer_reset_masks (hb_buffer_t *buffer,
83 _hb_buffer_add_masks (hb_buffer_t *buffer,
87 _hb_buffer_set_masks (hb_buffer_t *buffer,
90 unsigned int cluster_start,
91 unsigned int cluster_end);
95 hb_reference_count_t ref_count;
97 /* Information about how the text in the buffer should be treated */
99 hb_unicode_funcs_t *unicode; /* Unicode functions */
100 hb_segment_properties_t props; /* Script, language, direction */
102 /* Buffer contents */
104 unsigned int allocated; /* Length of allocated arrays */
106 hb_bool_t have_output; /* Whether we have an output buffer going on */
107 hb_bool_t have_positions; /* Whether we have positions */
108 hb_bool_t in_error; /* Allocation failed */
110 unsigned int i; /* Cursor into ->info and ->pos arrays */
111 unsigned int len; /* Length of ->info and ->pos arrays */
112 unsigned int out_len; /* Length of ->out array */
114 hb_glyph_info_t *info;
115 hb_glyph_info_t *out_info;
116 hb_glyph_position_t *pos;
124 inline unsigned int next_serial (void) { return serial++; }
125 inline void swap (void) { _hb_buffer_swap (this); }
126 inline void clear_output (void) { _hb_buffer_clear_output (this); }
127 inline void next_glyph (void) { _hb_buffer_next_glyph (this); }
128 inline void replace_glyphs (unsigned int num_in,
129 unsigned int num_out,
130 const hb_codepoint_t *glyph_data)
131 { _hb_buffer_replace_glyphs (this, num_in, num_out, glyph_data); }
132 inline void replace_glyphs_be16 (unsigned int num_in,
133 unsigned int num_out,
134 const uint16_t *glyph_data_be)
135 { _hb_buffer_replace_glyphs_be16 (this, num_in, num_out, glyph_data_be); }
136 inline void replace_glyph (hb_codepoint_t glyph_index)
137 { _hb_buffer_replace_glyph (this, glyph_index); }
139 inline void reset_masks (hb_mask_t mask)
141 for (unsigned int i = 0; i < len; i++)
144 inline void add_masks (hb_mask_t mask)
146 for (unsigned int i = 0; i < len; i++)
147 info[i].mask |= mask;
149 inline void set_masks (hb_mask_t value,
151 unsigned int cluster_start,
152 unsigned int cluster_end)
153 { _hb_buffer_set_masks (this, value, mask, cluster_start, cluster_end); }
160 #endif /* HB_BUFFER_PRIVATE_HH */