Rename a few files to be C++ sources
[profile/ivi/org.tizen.video-player.git] / src / hb-buffer-private.hh
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2004,2007,2009,2010  Red Hat, Inc.
4  *
5  * This is part of HarfBuzz, a text shaping 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_PRIVATE_H
29 #define HB_BUFFER_PRIVATE_H
30
31 #include "hb-private.h"
32 #include "hb-buffer.h"
33 #include "hb-unicode-private.h"
34
35 HB_BEGIN_DECLS
36
37 #define HB_BUFFER_GLYPH_PROPERTIES_UNKNOWN 0xFFFF
38
39
40 typedef struct _hb_internal_glyph_info_t {
41   hb_codepoint_t codepoint;
42   hb_mask_t      mask;
43   uint32_t       cluster;
44   uint16_t       component;
45   uint16_t       lig_id;
46   uint32_t       gproperty;
47 } hb_internal_glyph_info_t;
48
49 typedef struct _hb_internal_glyph_position_t {
50   hb_position_t  x_advance;
51   hb_position_t  y_advance;
52   hb_position_t  x_offset;
53   hb_position_t  y_offset;
54   uint32_t       back : 16;             /* number of glyphs to go back
55                                            for drawing current glyph */
56   int32_t        cursive_chain : 16;    /* character to which this connects,
57                                            may be positive or negative */
58 } hb_internal_glyph_position_t;
59
60 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_internal_glyph_info_t));
61 ASSERT_STATIC (sizeof (hb_glyph_position_t) == sizeof (hb_internal_glyph_position_t));
62 ASSERT_STATIC (sizeof (hb_glyph_info_t) == sizeof (hb_glyph_position_t));
63
64
65 struct _hb_buffer_t {
66   hb_reference_count_t ref_count;
67
68   /* Information about how the text in the buffer should be treated */
69   hb_unicode_funcs_t *unicode;
70   hb_direction_t      direction;
71   hb_script_t         script;
72   hb_language_t       language;
73
74   /* Buffer contents */
75
76   unsigned int allocated;
77
78   hb_bool_t    have_output; /* whether we have an output buffer going on */
79   hb_bool_t    have_positions; /* whether we have positions */
80   unsigned int in_length;
81   unsigned int out_length;
82   unsigned int in_pos;
83   unsigned int out_pos; /* out_length and out_pos are actually always the same */
84
85   hb_internal_glyph_info_t     *in_string;
86   hb_internal_glyph_info_t     *out_string;
87   hb_internal_glyph_position_t *positions;
88
89   /* Other stuff */
90
91   unsigned int         max_lig_id;
92 };
93
94
95 HB_INTERNAL void
96 _hb_buffer_swap (hb_buffer_t *buffer);
97
98 HB_INTERNAL void
99 _hb_buffer_clear_output (hb_buffer_t *buffer);
100
101 HB_INTERNAL void
102 _hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
103                               unsigned int num_in,
104                               unsigned int num_out,
105                               const hb_codepoint_t *glyph_data,
106                               unsigned short component,
107                               unsigned short ligID);
108
109 HB_INTERNAL void
110 _hb_buffer_add_output_glyphs_be16 (hb_buffer_t *buffer,
111                                    unsigned int num_in,
112                                    unsigned int num_out,
113                                    const uint16_t *glyph_data_be,
114                                    unsigned short component,
115                                    unsigned short ligID);
116
117 HB_INTERNAL void
118 _hb_buffer_add_output_glyph (hb_buffer_t *buffer,
119                              hb_codepoint_t glyph_index,
120                              unsigned short component,
121                              unsigned short ligID);
122
123 HB_INTERNAL void
124 _hb_buffer_next_glyph (hb_buffer_t *buffer);
125
126 HB_INTERNAL void
127 _hb_buffer_replace_glyph (hb_buffer_t *buffer,
128                           hb_codepoint_t glyph_index);
129
130 HB_INTERNAL unsigned short
131 _hb_buffer_allocate_lig_id (hb_buffer_t *buffer);
132
133
134 #ifndef BUFFER
135 #define BUFFER buffer
136 #endif
137
138 /* convenience macros */
139 #define IN_GLYPH(pos)           (BUFFER->in_string[(pos)].codepoint)
140 #define IN_INFO(pos)            (&BUFFER->in_string[(pos)])
141 #define IN_CURGLYPH()           (BUFFER->in_string[BUFFER->in_pos].codepoint)
142 #define IN_NEXTGLYPH()          (BUFFER->in_string[BUFFER->in_pos + 1].codepoint)
143 #define IN_CURINFO()            (&BUFFER->in_string[BUFFER->in_pos])
144 #define IN_MASK(pos)            (BUFFER->in_string[(pos)].mask)
145 #define IN_CLUSTER(pos)         (BUFFER->in_string[(pos)].cluster)
146 #define IN_LIGID(pos)           (BUFFER->in_string[(pos)].lig_id)
147 #define IN_COMPONENT(pos)       (BUFFER->in_string[(pos)].component)
148 #define POSITION(pos)           (&BUFFER->positions[(pos)])
149 #define CURPOSITION()           (&BUFFER->positions[BUFFER->in_pos])
150 #define OUT_GLYPH(pos)          (BUFFER->out_string[(pos)].codepoint)
151 #define OUT_INFO(pos)           (&BUFFER->out_string[(pos)])
152
153 HB_END_DECLS
154
155 #endif /* HB_BUFFER_PRIVATE_H */