2 * Copyright (C) 1998-2004 David Turner and Werner Lemberg
3 * Copyright (C) 2004,2007 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
28 #ifndef HARFBUZZ_BUFFER_PRIVATE_H
29 #define HARFBUZZ_BUFFER_PRIVATE_H
31 #include "harfbuzz-impl.h"
32 #include "harfbuzz-buffer.h"
36 #define HB_GLYPH_PROPERTY_UNKNOWN 0xFFFF
39 _hb_buffer_swap( HB_Buffer buffer );
42 _hb_buffer_clear_output( HB_Buffer buffer );
45 _hb_buffer_clear_positions( HB_Buffer buffer );
48 _hb_buffer_add_output_glyphs( HB_Buffer buffer,
51 HB_UShort *glyph_data,
56 _hb_buffer_add_output_glyph ( HB_Buffer buffer,
62 _hb_buffer_copy_output_glyph ( HB_Buffer buffer );
65 _hb_buffer_replace_output_glyph ( HB_Buffer buffer,
70 _hb_buffer_allocate_ligid( HB_Buffer buffer );
73 /* convenience macros */
75 #define IN_GLYPH( pos ) (buffer->in_string[(pos)].gindex)
76 #define IN_ITEM( pos ) (&buffer->in_string[(pos)])
77 #define IN_CURGLYPH() (buffer->in_string[buffer->in_pos].gindex)
78 #define IN_CURITEM() (&buffer->in_string[buffer->in_pos])
79 #define IN_PROPERTIES( pos ) (buffer->in_string[(pos)].properties)
80 #define IN_LIGID( pos ) (buffer->in_string[(pos)].ligID)
81 #define IN_COMPONENT( pos ) (buffer->in_string[(pos)].component)
82 #define POSITION( pos ) (&buffer->positions[(pos)])
83 #define OUT_GLYPH( pos ) (buffer->out_string[(pos)].gindex)
84 #define OUT_ITEM( pos ) (&buffer->out_string[(pos)])
86 #define CHECK_Property( layout, index, flags, properties ) \
87 ({unsigned int _p; error = _hb_ot_layout_check_glyph_property((layout), (index), (flags), (&_p)) \
88 ? HB_Err_Ok : HB_Err_Not_Covered, *(properties) = _p; error;})
90 #define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID ) \
91 ( ( error = _hb_buffer_add_output_glyphs( (buffer), \
92 (num_in), (num_out), \
93 (glyph_data), (component), (ligID) \
95 #define ADD_Glyph( buffer, glyph_index, component, ligID ) \
96 ( ( error = _hb_buffer_add_output_glyph( (buffer), \
97 (glyph_index), (component), (ligID) \
99 #define REPLACE_Glyph( buffer, glyph_index, nesting_level ) \
100 ( ( error = _hb_buffer_replace_output_glyph( (buffer), (glyph_index), \
101 (nesting_level) == 1 ) ) != HB_Err_Ok )
102 #define COPY_Glyph( buffer ) \
103 ( (error = _hb_buffer_copy_output_glyph ( buffer ) ) != HB_Err_Ok )
107 #endif /* HARFBUZZ_BUFFER_PRIVATE_H */