2 * Copyright (C) 2007,2008,2009 Red Hat, Inc.
4 * This is part of HarfBuzz, a text shaping library.
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.
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
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.
24 * Red Hat Author(s): Behdad Esfahbod
27 #ifndef HB_OT_LAYOUT_H
28 #define HB_OT_LAYOUT_H
30 #include "hb-common.h"
31 #include "hb-buffer.h"
34 #include "hb-ot-tag.h"
39 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
40 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
41 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
48 HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0x0000,
49 HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 0x0002,
50 HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 0x0004,
51 HB_OT_LAYOUT_GLYPH_CLASS_MARK = 0x0008,
52 HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 0x0010
53 } hb_ot_layout_glyph_class_t;
55 /* XXX These should eventually be removed as we move synthesized glyph
56 * classes in harfbuzz. */
59 hb_ot_layout_has_glyph_classes (hb_face_t *face);
61 hb_ot_layout_glyph_class_t
62 hb_ot_layout_get_glyph_class (hb_face_t *face,
63 hb_codepoint_t glyph);
66 hb_ot_layout_set_glyph_class (hb_face_t *face,
68 hb_ot_layout_glyph_class_t klass);
71 hb_ot_layout_build_glyph_classes (hb_face_t *face,
72 hb_codepoint_t *glyphs,
73 unsigned char *klasses,
76 /* Not that useful. Provides list of attach points for a glyph that a
77 * client may want to cache */
79 hb_ot_layout_get_attach_points (hb_face_t *face,
81 unsigned int start_offset,
82 unsigned int *point_count /* IN/OUT */,
83 unsigned int *point_array /* OUT */);
85 /* Ligature caret positions */
87 hb_ot_layout_get_lig_carets (hb_font_t *font,
89 hb_direction_t direction,
91 unsigned int start_offset,
92 unsigned int *caret_count /* IN/OUT */,
93 int *caret_array /* OUT */);
97 * GSUB/GPOS feature query and enumeration interface
100 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF)
101 #define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF)
102 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF)
105 hb_ot_layout_table_get_script_tags (hb_face_t *face,
107 unsigned int start_offset,
108 unsigned int *script_count /* IN/OUT */,
109 hb_tag_t *script_tags /* OUT */);
112 hb_ot_layout_table_find_script (hb_face_t *face,
115 unsigned int *script_index);
117 /* Like find_script, but takes zero-terminated array of scripts to test */
119 hb_ot_layout_table_choose_script (hb_face_t *face,
121 const hb_tag_t *script_tags,
122 unsigned int *script_index);
125 hb_ot_layout_table_get_feature_tags (hb_face_t *face,
127 unsigned int start_offset,
128 unsigned int *feature_count /* IN/OUT */,
129 hb_tag_t *feature_tags /* OUT */);
132 hb_ot_layout_script_get_language_tags (hb_face_t *face,
134 unsigned int script_index,
135 unsigned int start_offset,
136 unsigned int *language_count /* IN/OUT */,
137 hb_tag_t *language_tags /* OUT */);
140 hb_ot_layout_script_find_language (hb_face_t *face,
142 unsigned int script_index,
143 hb_tag_t language_tag,
144 unsigned int *language_index);
147 hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
149 unsigned int script_index,
150 unsigned int language_index,
151 unsigned int *feature_index);
154 hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
156 unsigned int script_index,
157 unsigned int language_index,
158 unsigned int start_offset,
159 unsigned int *feature_count /* IN/OUT */,
160 unsigned int *feature_indexes /* OUT */);
163 hb_ot_layout_language_get_feature_tags (hb_face_t *face,
165 unsigned int script_index,
166 unsigned int language_index,
167 unsigned int start_offset,
168 unsigned int *feature_count /* IN/OUT */,
169 hb_tag_t *feature_tags /* OUT */);
172 hb_ot_layout_language_find_feature (hb_face_t *face,
174 unsigned int script_index,
175 unsigned int language_index,
176 hb_tag_t feature_tag,
177 unsigned int *feature_index);
180 hb_ot_layout_feature_get_lookup_indexes (hb_face_t *face,
182 unsigned int feature_index,
183 unsigned int start_offset,
184 unsigned int *lookup_count /* IN/OUT */,
185 unsigned int *lookup_indexes /* OUT */);
193 hb_ot_layout_has_substitution (hb_face_t *face);
196 hb_ot_layout_substitute_lookup (hb_face_t *face,
198 unsigned int lookup_index,
206 hb_ot_layout_has_positioning (hb_face_t *face);
209 hb_ot_layout_position_lookup (hb_font_t *font,
212 unsigned int lookup_index,
215 /* Should be called after all the position_lookup's are done */
217 hb_ot_layout_position_finish (hb_font_t *font,
219 hb_buffer_t *buffer);
224 #endif /* HB_OT_LAYOUT_H */