[HB] More buffer cleanup
[framework/uifw/harfbuzz.git] / src / hb-buffer.h
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2004,2007,2009  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 HB_BUFFER_H
29 #define HB_BUFFER_H
30
31 #include "hb-common.h"
32
33 HB_BEGIN_DECLS
34
35 /* XXX  Hide structs? */
36
37 typedef struct _hb_glyph_info_t {
38   hb_codepoint_t gindex;
39   unsigned int   properties;
40   unsigned int   cluster;
41   unsigned short component;
42   unsigned short ligID;
43   unsigned short gproperty;
44 } hb_glyph_info_t;
45
46 typedef struct _hb_glyph_position_t {
47   hb_position_t  x_pos;
48   hb_position_t  y_pos;
49   hb_position_t  x_advance;
50   hb_position_t  y_advance;
51   unsigned short back;          /* number of glyphs to go back
52                                    for drawing current glyph   */
53   hb_bool_t      new_advance;   /* if set, the advance width values are
54                                    absolute, i.e., they won't be
55                                    added to the original glyph's value
56                                    but rather replace them.            */
57   short          cursive_chain; /* character to which this connects,
58                                    may be positive or negative; used
59                                    only internally                     */
60 } hb_glyph_position_t;
61
62
63 typedef struct _hb_buffer_t {
64   unsigned int allocated;
65
66   unsigned int in_length;
67   unsigned int out_length;
68   unsigned int in_pos;
69   unsigned int out_pos;
70
71   hb_bool_t            separate_out;
72   hb_glyph_info_t     *in_string;
73   hb_glyph_info_t     *out_string;
74   hb_glyph_info_t     *alt_string;
75   hb_glyph_position_t *positions;
76   unsigned int         max_lig_id;
77 } hb_buffer_t;
78
79 hb_buffer_t *
80 hb_buffer_new (void);
81
82 void
83 hb_buffer_free (hb_buffer_t *buffer);
84
85 void
86 hb_buffer_clear (hb_buffer_t *buffer);
87
88 void
89 hb_buffer_add_glyph (hb_buffer_t    *buffer,
90                      hb_codepoint_t  glyph_index,
91                      unsigned int    properties,
92                      unsigned int    cluster);
93
94 HB_END_DECLS
95
96 #endif /* HB_BUFFER_H */