Imported Upstream version 0.9.3
[platform/upstream/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 /*
47  * GDEF
48  */
49
50 hb_bool_t
51 hb_ot_layout_has_glyph_classes (hb_face_t *face);
52
53 /* Not that useful.  Provides list of attach points for a glyph that a
54  * client may want to cache */
55 unsigned int
56 hb_ot_layout_get_attach_points (hb_face_t      *face,
57                                 hb_codepoint_t  glyph,
58                                 unsigned int    start_offset,
59                                 unsigned int   *point_count /* IN/OUT */,
60                                 unsigned int   *point_array /* OUT */);
61
62 /* Ligature caret positions */
63 unsigned int
64 hb_ot_layout_get_ligature_carets (hb_font_t      *font,
65                                   hb_direction_t  direction,
66                                   hb_codepoint_t  glyph,
67                                   unsigned int    start_offset,
68                                   unsigned int   *caret_count /* IN/OUT */,
69                                   hb_position_t  *caret_array /* OUT */);
70
71
72 /*
73  * GSUB/GPOS feature query and enumeration interface
74  */
75
76 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX            ((unsigned int) 0xFFFF)
77 #define HB_OT_LAYOUT_NO_FEATURE_INDEX           ((unsigned int) 0xFFFF)
78 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX     ((unsigned int) 0xFFFF)
79
80 unsigned int
81 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
82                                     hb_tag_t      table_tag,
83                                     unsigned int  start_offset,
84                                     unsigned int *script_count /* IN/OUT */,
85                                     hb_tag_t     *script_tags /* OUT */);
86
87 hb_bool_t
88 hb_ot_layout_table_find_script (hb_face_t    *face,
89                                 hb_tag_t      table_tag,
90                                 hb_tag_t      script_tag,
91                                 unsigned int *script_index);
92
93 /* Like find_script, but takes zero-terminated array of scripts to test */
94 hb_bool_t
95 hb_ot_layout_table_choose_script (hb_face_t      *face,
96                                   hb_tag_t        table_tag,
97                                   const hb_tag_t *script_tags,
98                                   unsigned int   *script_index,
99                                   hb_tag_t       *chosen_script);
100
101 unsigned int
102 hb_ot_layout_table_get_feature_tags (hb_face_t    *face,
103                                      hb_tag_t      table_tag,
104                                      unsigned int  start_offset,
105                                      unsigned int *feature_count /* IN/OUT */,
106                                      hb_tag_t     *feature_tags /* OUT */);
107
108 unsigned int
109 hb_ot_layout_script_get_language_tags (hb_face_t    *face,
110                                        hb_tag_t      table_tag,
111                                        unsigned int  script_index,
112                                        unsigned int  start_offset,
113                                        unsigned int *language_count /* IN/OUT */,
114                                        hb_tag_t     *language_tags /* OUT */);
115
116 hb_bool_t
117 hb_ot_layout_script_find_language (hb_face_t    *face,
118                                    hb_tag_t      table_tag,
119                                    unsigned int  script_index,
120                                    hb_tag_t      language_tag,
121                                    unsigned int *language_index);
122
123 hb_bool_t
124 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
125                                                   hb_tag_t      table_tag,
126                                                   unsigned int  script_index,
127                                                   unsigned int  language_index,
128                                                   unsigned int *feature_index);
129
130 unsigned int
131 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
132                                            hb_tag_t      table_tag,
133                                            unsigned int  script_index,
134                                            unsigned int  language_index,
135                                            unsigned int  start_offset,
136                                            unsigned int *feature_count /* IN/OUT */,
137                                            unsigned int *feature_indexes /* OUT */);
138
139 unsigned int
140 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
141                                         hb_tag_t      table_tag,
142                                         unsigned int  script_index,
143                                         unsigned int  language_index,
144                                         unsigned int  start_offset,
145                                         unsigned int *feature_count /* IN/OUT */,
146                                         hb_tag_t     *feature_tags /* OUT */);
147
148 hb_bool_t
149 hb_ot_layout_language_find_feature (hb_face_t    *face,
150                                     hb_tag_t      table_tag,
151                                     unsigned int  script_index,
152                                     unsigned int  language_index,
153                                     hb_tag_t      feature_tag,
154                                     unsigned int *feature_index);
155
156 unsigned int
157 hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
158                                          hb_tag_t      table_tag,
159                                          unsigned int  feature_index,
160                                          unsigned int  start_offset,
161                                          unsigned int *lookup_count /* IN/OUT */,
162                                          unsigned int *lookup_indexes /* OUT */);
163
164
165 /*
166  * GSUB
167  */
168
169 hb_bool_t
170 hb_ot_layout_has_substitution (hb_face_t *face);
171
172 hb_bool_t
173 hb_ot_layout_would_substitute_lookup (hb_face_t            *face,
174                                       const hb_codepoint_t *glyphs,
175                                       unsigned int          glyphs_length,
176                                       unsigned int          lookup_index);
177
178 void
179 hb_ot_layout_substitute_closure_lookup (hb_face_t    *face,
180                                         hb_set_t     *glyphs,
181                                         unsigned int  lookup_index);
182
183 /*
184  * GPOS
185  */
186
187 hb_bool_t
188 hb_ot_layout_has_positioning (hb_face_t *face);
189
190
191 HB_END_DECLS
192
193 #endif /* HB_OT_LAYOUT_H */