[HB] Rename hb_ot_layout_feature_mask_t to hb_mask_t
[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, an OpenType Layout engine 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 HB_BEGIN_DECLS
35
36 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
37 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
38 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
39
40 /*
41  * GDEF
42  */
43
44 typedef enum {
45   HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0000,
46   HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH   = 0x0002,
47   HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE     = 0x0004,
48   HB_OT_LAYOUT_GLYPH_CLASS_MARK         = 0x0008,
49   HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT    = 0x0010
50 } hb_ot_layout_glyph_class_t;
51
52 /* XXX These should eventually be removed as we move synthesized glyph
53  * classes in harfbuzz. */
54
55 hb_bool_t
56 hb_ot_layout_has_font_glyph_classes (hb_face_t *face);
57
58 hb_ot_layout_glyph_class_t
59 hb_ot_layout_get_glyph_class (hb_face_t      *face,
60                               hb_codepoint_t  glyph);
61
62 void
63 hb_ot_layout_set_glyph_class (hb_face_t                 *face,
64                               hb_codepoint_t             glyph,
65                               hb_ot_layout_glyph_class_t klass);
66
67 void
68 hb_ot_layout_build_glyph_classes (hb_face_t      *face,
69                                 uint16_t        num_total_glyphs,
70                                 hb_codepoint_t *glyphs,
71                                 unsigned char  *klasses,
72                                 uint16_t        count);
73
74 /* Not that useful.  Provides list of attach points for a glyph that a
75  * client may want to cache */
76 hb_bool_t
77 hb_ot_layout_get_attach_points (hb_face_t      *face,
78                                 hb_codepoint_t  glyph,
79                                 unsigned int   *point_count /* IN/OUT */,
80                                 unsigned int   *point_array /* OUT */);
81
82 /* Ligature caret positions */
83 hb_bool_t
84 hb_ot_layout_get_lig_carets (hb_face_t      *face,
85                              hb_font_t      *font,
86                              hb_codepoint_t  glyph,
87                              unsigned int   *caret_count /* IN/OUT */,
88                              int            *caret_array /* OUT */);
89
90
91 /*
92  * GSUB/GPOS feature query and enumeration interface
93  */
94
95 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX            ((unsigned int) 0xFFFF)
96 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           ((unsigned int) 0xFFFF)
97 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     ((unsigned int) 0xFFFF)
98 #define HB_OT_LAYOUT_TAG_DEFAULT_SCRIPT         HB_TAG ('D', 'F', 'L', 'T')
99 #define HB_OT_LAYOUT_TAG_DEFAULT_LANGUAGE       HB_TAG ('d', 'f', 'l', 't')
100
101 hb_bool_t
102 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
103                                     hb_tag_t      table_tag,
104                                     unsigned int *script_count /* IN/OUT */,
105                                     hb_tag_t     *script_tags /* OUT */);
106
107 hb_bool_t
108 hb_ot_layout_table_find_script (hb_face_t    *face,
109                                 hb_tag_t      table_tag,
110                                 hb_tag_t      script_tag,
111                                 unsigned int *script_index);
112
113 hb_bool_t
114 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
115                                      hb_tag_t      table_tag,
116                                      unsigned int *feature_count /* IN/OUT */,
117                                      hb_tag_t     *feature_tags /* OUT */);
118
119 hb_bool_t
120 hb_ot_layout_table_find_feature (hb_face_t    *face,
121                                  hb_tag_t      table_tag,
122                                  hb_tag_t      feature_tag,
123                                  unsigned int *feature_index);
124
125 hb_bool_t
126 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
127                                        hb_tag_t      table_tag,
128                                        unsigned int  script_index,
129                                        unsigned int *language_count /* IN/OUT */,
130                                        hb_tag_t     *language_tags /* OUT */);
131
132 hb_bool_t
133 hb_ot_layout_script_find_language (hb_face_t    *face,
134                                    hb_tag_t      table_tag,
135                                    unsigned int  script_index,
136                                    hb_tag_t      language_tag,
137                                    unsigned int *language_index);
138
139 hb_bool_t
140 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
141                                                   hb_tag_t      table_tag,
142                                                   unsigned int  script_index,
143                                                   unsigned int  language_index,
144                                                   unsigned int *feature_index);
145
146 hb_bool_t
147 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
148                                            hb_tag_t      table_tag,
149                                            unsigned int  script_index,
150                                            unsigned int  language_index,
151                                            unsigned int *feature_count /* IN/OUT */,
152                                            unsigned int *feature_indexes /* OUT */);
153
154 hb_bool_t
155 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
156                                         hb_tag_t      table_tag,
157                                         unsigned int  script_index,
158                                         unsigned int  language_index,
159                                         unsigned int *feature_count /* IN/OUT */,
160                                         hb_tag_t     *feature_tags /* OUT */);
161
162 hb_bool_t
163 hb_ot_layout_language_find_feature (hb_face_t    *face,
164                                     hb_tag_t      table_tag,
165                                     unsigned int  script_index,
166                                     unsigned int  language_index,
167                                     hb_tag_t      feature_tag,
168                                     unsigned int *feature_index);
169
170 hb_bool_t
171 hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
172                                          hb_tag_t      table_tag,
173                                          unsigned int  feature_index,
174                                          unsigned int *lookup_count /* IN/OUT */,
175                                          unsigned int *lookup_indexes /* OUT */);
176
177
178 /*
179  * GSUB
180  */
181
182 hb_bool_t
183 hb_ot_layout_has_substitution (hb_face_t *face);
184
185 hb_bool_t
186 hb_ot_layout_substitute_lookup (hb_face_t    *face,
187                                 hb_buffer_t  *buffer,
188                                 unsigned int  lookup_index,
189                                 hb_mask_t     mask);
190
191 /*
192  * GPOS
193  */
194
195 hb_bool_t
196 hb_ot_layout_has_positioning (hb_face_t *face);
197
198 hb_bool_t
199 hb_ot_layout_position_lookup   (hb_face_t    *face,
200                                 hb_font_t    *font,
201                                 hb_buffer_t  *buffer,
202                                 unsigned int  lookup_index,
203                                 hb_mask_t     mask);
204
205
206 HB_END_DECLS
207
208 #endif /* HB_OT_LAYOUT_H */