Tizen 2.1 base
[external/pango1.0.git] / pango / opentype / 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_script_get_language_tags (hb_face_t    *face,
121                                        hb_tag_t      table_tag,
122                                        unsigned int  script_index,
123                                        unsigned int *language_count /* IN/OUT */,
124                                        hb_tag_t     *language_tags /* OUT */);
125
126 hb_bool_t
127 hb_ot_layout_script_find_language (hb_face_t    *face,
128                                    hb_tag_t      table_tag,
129                                    unsigned int  script_index,
130                                    hb_tag_t      language_tag,
131                                    unsigned int *language_index);
132
133 hb_bool_t
134 hb_ot_layout_language_get_required_feature_index (hb_face_t    *face,
135                                                   hb_tag_t      table_tag,
136                                                   unsigned int  script_index,
137                                                   unsigned int  language_index,
138                                                   unsigned int *feature_index);
139
140 hb_bool_t
141 hb_ot_layout_language_get_feature_indexes (hb_face_t    *face,
142                                            hb_tag_t      table_tag,
143                                            unsigned int  script_index,
144                                            unsigned int  language_index,
145                                            unsigned int *feature_count /* IN/OUT */,
146                                            unsigned int *feature_indexes /* OUT */);
147
148 hb_bool_t
149 hb_ot_layout_language_get_feature_tags (hb_face_t    *face,
150                                         hb_tag_t      table_tag,
151                                         unsigned int  script_index,
152                                         unsigned int  language_index,
153                                         unsigned int *feature_count /* IN/OUT */,
154                                         hb_tag_t     *feature_tags /* OUT */);
155
156 hb_bool_t
157 hb_ot_layout_language_find_feature (hb_face_t    *face,
158                                     hb_tag_t      table_tag,
159                                     unsigned int  script_index,
160                                     unsigned int  language_index,
161                                     hb_tag_t      feature_tag,
162                                     unsigned int *feature_index);
163
164 hb_bool_t
165 hb_ot_layout_feature_get_lookup_indexes (hb_face_t    *face,
166                                          hb_tag_t      table_tag,
167                                          unsigned int  feature_index,
168                                          unsigned int *lookup_count /* IN/OUT */,
169                                          unsigned int *lookup_indexes /* OUT */);
170
171
172 /*
173  * GSUB
174  */
175
176 hb_bool_t
177 hb_ot_layout_has_substitution (hb_face_t *face);
178
179 hb_bool_t
180 hb_ot_layout_substitute_lookup (hb_face_t    *face,
181                                 hb_buffer_t  *buffer,
182                                 unsigned int  lookup_index,
183                                 hb_mask_t     mask);
184
185 /*
186  * GPOS
187  */
188
189 hb_bool_t
190 hb_ot_layout_has_positioning (hb_face_t *face);
191
192 hb_bool_t
193 hb_ot_layout_position_lookup   (hb_face_t    *face,
194                                 hb_font_t    *font,
195                                 hb_buffer_t  *buffer,
196                                 unsigned int  lookup_index,
197                                 hb_mask_t     mask);
198
199
200 HB_END_DECLS
201
202 #endif /* HB_OT_LAYOUT_H */