b8b5baf3b3da80adbb24b1a4931c50f3731aaa90
[framework/uifw/harfbuzz.git] / src / hb-ot-layout.h
1 /*
2  * Copyright © 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_H_IN
28 #error "Include <hb-ot.h> instead."
29 #endif
30
31 #ifndef HB_OT_LAYOUT_H
32 #define HB_OT_LAYOUT_H
33
34 #include "hb.h"
35
36 #include "hb-ot-tag.h"
37
38 HB_BEGIN_DECLS
39
40
41 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
42 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
43 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
44
45 /*
46  * GDEF
47  */
48
49 hb_bool_t
50 hb_ot_layout_has_glyph_classes (hb_face_t *face);
51
52 /* Not that useful.  Provides list of attach points for a glyph that a
53  * client may want to cache */
54 unsigned int
55 hb_ot_layout_get_attach_points (hb_face_t      *face,
56                                 hb_codepoint_t  glyph,
57                                 unsigned int    start_offset,
58                                 unsigned int   *point_count /* IN/OUT */,
59                                 unsigned int   *point_array /* OUT */);
60
61 /* Ligature caret positions */
62 unsigned int
63 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
64                                   hb_direction_t  direction,
65                                   hb_codepoint_t  glyph,
66                                   unsigned int    start_offset,
67                                   unsigned int   *caret_count /* IN/OUT */,
68                                   hb_position_t  *caret_array /* OUT */);
69
70
71 /*
72  * GSUB/GPOS feature query and enumeration interface
73  */
74
75 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX            ((unsigned int) 0xFFFF)
76 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           ((unsigned int) 0xFFFF)
77 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     ((unsigned int) 0xFFFF)
78
79 unsigned int
80 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
81                                     hb_tag_t      table_tag,
82                                     unsigned int  start_offset,
83                                     unsigned int *script_count /* IN/OUT */,
84                                     hb_tag_t     *script_tags /* OUT */);
85
86 hb_bool_t
87 hb_ot_layout_table_find_script (hb_face_t    *face,
88                                 hb_tag_t      table_tag,
89                                 hb_tag_t      script_tag,
90                                 unsigned int *script_index);
91
92 /* Like find_script, but takes zero-terminated array of scripts to test */
93 hb_bool_t
94 hb_ot_layout_table_choose_script (hb_face_t      *face,
95                                   hb_tag_t        table_tag,
96                                   const hb_tag_t *script_tags,
97                                   unsigned int   *script_index,
98                                   hb_tag_t       *chosen_script);
99
100 unsigned int
101 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
102                                      hb_tag_t      table_tag,
103                                      unsigned int  start_offset,
104                                      unsigned int *feature_count /* IN/OUT */,
105                                      hb_tag_t     *feature_tags /* OUT */);
106
107 unsigned int
108 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
109                                        hb_tag_t      table_tag,
110                                        unsigned int  script_index,
111                                        unsigned int  start_offset,
112                                        unsigned int *language_count /* IN/OUT */,
113                                        hb_tag_t     *language_tags /* OUT */);
114
115 hb_bool_t
116 hb_ot_layout_script_find_language (hb_face_t    *face,
117                                    hb_tag_t      table_tag,
118                                    unsigned int  script_index,
119                                    hb_tag_t      language_tag,
120                                    unsigned int *language_index);
121
122 hb_bool_t
123 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
124                                                   hb_tag_t      table_tag,
125                                                   unsigned int  script_index,
126                                                   unsigned int  language_index,
127                                                   unsigned int *feature_index);
128
129 unsigned int
130 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
131                                            hb_tag_t      table_tag,
132                                            unsigned int  script_index,
133                                            unsigned int  language_index,
134                                            unsigned int  start_offset,
135                                            unsigned int *feature_count /* IN/OUT */,
136                                            unsigned int *feature_indexes /* OUT */);
137
138 unsigned int
139 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
140                                         hb_tag_t      table_tag,
141                                         unsigned int  script_index,
142                                         unsigned int  language_index,
143                                         unsigned int  start_offset,
144                                         unsigned int *feature_count /* IN/OUT */,
145                                         hb_tag_t     *feature_tags /* OUT */);
146
147 hb_bool_t
148 hb_ot_layout_language_find_feature (hb_face_t    *face,
149                                     hb_tag_t      table_tag,
150                                     unsigned int  script_index,
151                                     unsigned int  language_index,
152                                     hb_tag_t      feature_tag,
153                                     unsigned int *feature_index);
154
155 unsigned int
156 hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
157                                          hb_tag_t      table_tag,
158                                          unsigned int  feature_index,
159                                          unsigned int  start_offset,
160                                          unsigned int *lookup_count /* IN/OUT */,
161                                          unsigned int *lookup_indexes /* OUT */);
162
163
164 /*
165  * GSUB
166  */
167
168 hb_bool_t
169 hb_ot_layout_has_substitution (hb_face_t *face);
170
171 /* Should be called before all the substitute_lookup's are done. */
172 void
173 hb_ot_layout_substitute_start (hb_buffer_t  *buffer);
174
175 hb_bool_t
176 hb_ot_layout_substitute_lookup (hb_face_t    *face,
177                                 hb_buffer_t  *buffer,
178                                 unsigned int  lookup_index,
179                                 hb_mask_t     mask);
180
181 /* Should be called after all the substitute_lookup's are done */
182 void
183 hb_ot_layout_substitute_finish (hb_buffer_t  *buffer);
184
185
186 void
187 hb_ot_layout_substitute_closure_lookup (hb_face_t    *face,
188                                         hb_set_t     *glyphs,
189                                         unsigned int  lookup_index);
190
191 /*
192  * GPOS
193  */
194
195 hb_bool_t
196 hb_ot_layout_has_positioning (hb_face_t *face);
197
198 /* Should be called before all the position_lookup's are done.  Resets positions to zero. */
199 void
200 hb_ot_layout_position_start (hb_buffer_t  *buffer);
201
202 hb_bool_t
203 hb_ot_layout_position_lookup (hb_font_t    *font,
204                               hb_buffer_t  *buffer,
205                               unsigned int  lookup_index,
206                               hb_mask_t     mask);
207
208 /* Should be called after all the position_lookup's are done */
209 void
210 hb_ot_layout_position_finish (hb_buffer_t  *buffer);
211
212
213 HB_END_DECLS
214
215 #endif /* HB_OT_LAYOUT_H */