1/*
2 * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3 * Copyright (C) 2004,2007  Red Hat, Inc.
4 *
5 * This is part of HarfBuzz, an OpenType Layout engine library.
6 *
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.
12 *
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
17 * DAMAGE.
18 *
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.
24 *
25 * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
26 */
27
28#ifndef HARFBUZZ_BUFFER_PRIVATE_H
29#define HARFBUZZ_BUFFER_PRIVATE_H
30
31#include "harfbuzz-impl.h"
32#include "harfbuzz-buffer.h"
33
34HB_BEGIN_HEADER
35
36#define HB_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
37
38HB_INTERNAL void
39_hb_buffer_swap( HB_Buffer buffer );
40
41HB_INTERNAL void
42_hb_buffer_clear_output( HB_Buffer buffer );
43
44HB_INTERNAL HB_Error
45_hb_buffer_clear_positions( HB_Buffer buffer );
46
47HB_INTERNAL HB_Error
48_hb_buffer_add_output_glyphs( HB_Buffer  buffer,
49			      HB_UShort  num_in,
50			      HB_UShort  num_out,
51			      HB_UShort *glyph_data,
52			      HB_UShort  component,
53			      HB_UShort  ligID );
54
55HB_INTERNAL HB_Error
56_hb_buffer_add_output_glyph ( HB_Buffer buffer,
57			      HB_UInt   glyph_index,
58			      HB_UShort component,
59			      HB_UShort ligID );
60
61HB_INTERNAL HB_Error
62_hb_buffer_copy_output_glyph ( HB_Buffer buffer );
63
64HB_INTERNAL HB_Error
65_hb_buffer_replace_output_glyph ( HB_Buffer buffer,
66				  HB_UInt   glyph_index,
67				  HB_Bool   inplace );
68
69HB_INTERNAL HB_UShort
70_hb_buffer_allocate_ligid( HB_Buffer buffer );
71
72
73/* convenience macros */
74
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)])
85
86#define CHECK_Property( gdef, index, flags, property )					\
87          ( ( error = _HB_GDEF_Check_Property( (gdef), (index), (flags),		\
88                                      (property) ) ) != HB_Err_Ok )
89
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)  \
94                                                  ) ) != HB_Err_Ok )
95#define ADD_Glyph( buffer, glyph_index, component, ligID )				\
96          ( ( error = _hb_buffer_add_output_glyph( (buffer),                             \
97                                                    (glyph_index), (component), (ligID) \
98                                                  ) ) != HB_Err_Ok )
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 )
104
105HB_END_HEADER
106
107#endif /* HARFBUZZ_BUFFER_PRIVATE_H */
108