Further cleanup of sizeof
[framework/uifw/harfbuzz.git] / src / hb-ot-layout.h
1 /*
2  * Copyright (C) 2007,2008,2009  Red Hat, Inc.
3  *
4  *  This is part of HarfBuzz, a text shaping library.
5  *
6  * Permission is hereby granted, without written agreement and without
7  * license or royalty fees, to use, copy, modify, and distribute this
8  * software and its documentation for any purpose, provided that the
9  * above copyright notice and the following two paragraphs appear in
10  * all copies of this software.
11  *
12  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
13  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
14  * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
15  * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
16  * DAMAGE.
17  *
18  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
19  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
20  * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23  *
24  * Red Hat Author(s): Behdad Esfahbod
25  */
26
27 #ifndef HB_OT_LAYOUT_H
28 #define HB_OT_LAYOUT_H
29
30 #include "hb-common.h"
31 #include "hb-buffer.h"
32 #include "hb-font.h"
33
34 #include "hb-ot-tag.h"
35
36 HB_BEGIN_DECLS
37
38 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
39 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
40 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
41
42 /*
43  * GDEF
44  */
45
46 typedef enum {
47   HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0000,
48   HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH   = 0x0002,
49   HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE     = 0x0004,
50   HB_OT_LAYOUT_GLYPH_CLASS_MARK         = 0x0008,
51   HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT    = 0x0010
52 } hb_ot_layout_glyph_class_t;
53
54 /* XXX These should eventually be removed as we move synthesized glyph
55  * classes in harfbuzz. */
56
57 hb_bool_t
58 hb_ot_layout_has_glyph_classes (hb_face_t *face);
59
60 hb_ot_layout_glyph_class_t
61 hb_ot_layout_get_glyph_class (hb_face_t      *face,
62                               hb_codepoint_t  glyph);
63
64 void
65 hb_ot_layout_set_glyph_class (hb_face_t                 *face,
66                               hb_codepoint_t             glyph,
67                               hb_ot_layout_glyph_class_t klass);
68
69 void
70 hb_ot_layout_build_glyph_classes (hb_face_t      *face,
71                                   hb_codepoint_t *glyphs,
72                                   unsigned char  *klasses,
73                                   uint16_t        count);
74
75 /* Not that useful.  Provides list of attach points for a glyph that a
76  * client may want to cache */
77 unsigned int
78 hb_ot_layout_get_attach_points (hb_face_t      *face,
79                                 hb_codepoint_t  glyph,
80                                 unsigned int    start_offset,
81                                 unsigned int   *point_count /* IN/OUT */,
82                                 unsigned int   *point_array /* OUT */);
83
84 /* Ligature caret positions */
85 unsigned int
86 hb_ot_layout_get_lig_carets (hb_font_t      *font,
87                              hb_face_t      *face,
88                              hb_codepoint_t  glyph,
89                              unsigned int    start_offset,
90                              unsigned int   *caret_count /* IN/OUT */,
91                              int            *caret_array /* OUT */);
92
93
94 /*
95  * GSUB/GPOS feature query and enumeration interface
96  */
97
98 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX            ((unsigned int) 0xFFFF)
99 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           ((unsigned int) 0xFFFF)
100 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     ((unsigned int) 0xFFFF)
101
102 unsigned int
103 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
104                                     hb_tag_t      table_tag,
105                                     unsigned int  start_offset,
106                                     unsigned int *script_count /* IN/OUT */,
107                                     hb_tag_t     *script_tags /* OUT */);
108
109 hb_bool_t
110 hb_ot_layout_table_find_script (hb_face_t    *face,
111                                 hb_tag_t      table_tag,
112                                 hb_tag_t      script_tag,
113                                 unsigned int *script_index);
114
115 /* Like find_script, but takes zero-terminated array of scripts to test */
116 hb_bool_t
117 hb_ot_layout_table_choose_script (hb_face_t      *face,
118                                   hb_tag_t        table_tag,
119                                   const hb_tag_t *script_tags,
120                                   unsigned int   *script_index);
121
122 unsigned int
123 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
124                                      hb_tag_t      table_tag,
125                                      unsigned int  start_offset,
126                                      unsigned int *feature_count /* IN/OUT */,
127                                      hb_tag_t     *feature_tags /* OUT */);
128
129 unsigned int
130 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
131                                        hb_tag_t      table_tag,
132                                        unsigned int  script_index,
133                                        unsigned int  start_offset,
134                                        unsigned int *language_count /* IN/OUT */,
135                                        hb_tag_t     *language_tags /* OUT */);
136
137 hb_bool_t
138 hb_ot_layout_script_find_language (hb_face_t    *face,
139                                    hb_tag_t      table_tag,
140                                    unsigned int  script_index,
141                                    hb_tag_t      language_tag,
142                                    unsigned int *language_index);
143
144 hb_bool_t
145 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
146                                                   hb_tag_t      table_tag,
147                                                   unsigned int  script_index,
148                                                   unsigned int  language_index,
149                                                   unsigned int *feature_index);
150
151 unsigned int
152 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
153                                            hb_tag_t      table_tag,
154                                            unsigned int  script_index,
155                                            unsigned int  language_index,
156                                            unsigned int  start_offset,
157                                            unsigned int *feature_count /* IN/OUT */,
158                                            unsigned int *feature_indexes /* OUT */);
159
160 unsigned int
161 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
162                                         hb_tag_t      table_tag,
163                                         unsigned int  script_index,
164                                         unsigned int  language_index,
165                                         unsigned int  start_offset,
166                                         unsigned int *feature_count /* IN/OUT */,
167                                         hb_tag_t     *feature_tags /* OUT */);
168
169 hb_bool_t
170 hb_ot_layout_language_find_feature (hb_face_t    *face,
171                                     hb_tag_t      table_tag,
172                                     unsigned int  script_index,
173                                     unsigned int  language_index,
174                                     hb_tag_t      feature_tag,
175                                     unsigned int *feature_index);
176
177 unsigned int
178 hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
179                                          hb_tag_t      table_tag,
180                                          unsigned int  feature_index,
181                                          unsigned int  start_offset,
182                                          unsigned int *lookup_count /* IN/OUT */,
183                                          unsigned int *lookup_indexes /* OUT */);
184
185
186 /*
187  * GSUB
188  */
189
190 hb_bool_t
191 hb_ot_layout_has_substitution (hb_face_t *face);
192
193 hb_bool_t
194 hb_ot_layout_substitute_lookup (hb_face_t    *face,
195                                 hb_buffer_t  *buffer,
196                                 unsigned int  lookup_index,
197                                 hb_mask_t     mask);
198
199 /*
200  * GPOS
201  */
202
203 hb_bool_t
204 hb_ot_layout_has_positioning (hb_face_t *face);
205
206 hb_bool_t
207 hb_ot_layout_position_lookup (hb_font_t    *font,
208                               hb_face_t    *face,
209                               hb_buffer_t  *buffer,
210                               unsigned int  lookup_index,
211                               hb_mask_t     mask);
212
213 /* Should be called after all the position_lookup's are done */
214 void
215 hb_ot_layout_position_finish (hb_font_t    *font,
216                               hb_face_t    *face,
217                               hb_buffer_t  *buffer);
218
219
220 HB_END_DECLS
221
222 #endif /* HB_OT_LAYOUT_H */