2 * Copyright © 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
28 #error "Include <hb-ot.h> instead."
31 #ifndef HB_OT_LAYOUT_H
32 #define HB_OT_LAYOUT_H
36 #include "hb-ot-tag.h"
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 #define HB_OT_TAG_JSTF HB_TAG('J','S','T','F')
52 hb_ot_layout_has_glyph_classes (hb_face_t *face);
55 HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0,
56 HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1,
57 HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2,
58 HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3,
59 HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
60 } hb_ot_layout_glyph_class_t;
62 hb_ot_layout_glyph_class_t
63 hb_ot_layout_get_glyph_class (hb_face_t *face,
64 hb_codepoint_t glyph);
67 hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
68 hb_ot_layout_glyph_class_t klass,
69 hb_set_t *glyphs /* OUT */);
72 /* Not that useful. Provides list of attach points for a glyph that a
73 * client may want to cache */
75 hb_ot_layout_get_attach_points (hb_face_t *face,
77 unsigned int start_offset,
78 unsigned int *point_count /* IN/OUT */,
79 unsigned int *point_array /* OUT */);
81 /* Ligature caret positions */
83 hb_ot_layout_get_ligature_carets (hb_font_t *font,
84 hb_direction_t direction,
86 unsigned int start_offset,
87 unsigned int *caret_count /* IN/OUT */,
88 hb_position_t *caret_array /* OUT */);
92 * GSUB/GPOS feature query and enumeration interface
95 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu
96 #define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu
97 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu
100 hb_ot_layout_table_get_script_tags (hb_face_t *face,
102 unsigned int start_offset,
103 unsigned int *script_count /* IN/OUT */,
104 hb_tag_t *script_tags /* OUT */);
107 hb_ot_layout_table_find_script (hb_face_t *face,
110 unsigned int *script_index);
112 /* Like find_script, but takes zero-terminated array of scripts to test */
114 hb_ot_layout_table_choose_script (hb_face_t *face,
116 const hb_tag_t *script_tags,
117 unsigned int *script_index,
118 hb_tag_t *chosen_script);
121 hb_ot_layout_table_get_feature_tags (hb_face_t *face,
123 unsigned int start_offset,
124 unsigned int *feature_count /* IN/OUT */,
125 hb_tag_t *feature_tags /* OUT */);
128 hb_ot_layout_script_get_language_tags (hb_face_t *face,
130 unsigned int script_index,
131 unsigned int start_offset,
132 unsigned int *language_count /* IN/OUT */,
133 hb_tag_t *language_tags /* OUT */);
136 hb_ot_layout_script_find_language (hb_face_t *face,
138 unsigned int script_index,
139 hb_tag_t language_tag,
140 unsigned int *language_index);
143 hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
145 unsigned int script_index,
146 unsigned int language_index,
147 unsigned int *feature_index);
150 hb_ot_layout_language_get_required_feature (hb_face_t *face,
152 unsigned int script_index,
153 unsigned int language_index,
154 unsigned int *feature_index,
155 hb_tag_t *feature_tag);
158 hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
160 unsigned int script_index,
161 unsigned int language_index,
162 unsigned int start_offset,
163 unsigned int *feature_count /* IN/OUT */,
164 unsigned int *feature_indexes /* OUT */);
167 hb_ot_layout_language_get_feature_tags (hb_face_t *face,
169 unsigned int script_index,
170 unsigned int language_index,
171 unsigned int start_offset,
172 unsigned int *feature_count /* IN/OUT */,
173 hb_tag_t *feature_tags /* OUT */);
176 hb_ot_layout_language_find_feature (hb_face_t *face,
178 unsigned int script_index,
179 unsigned int language_index,
180 hb_tag_t feature_tag,
181 unsigned int *feature_index);
184 hb_ot_layout_feature_get_lookups (hb_face_t *face,
186 unsigned int feature_index,
187 unsigned int start_offset,
188 unsigned int *lookup_count /* IN/OUT */,
189 unsigned int *lookup_indexes /* OUT */);
192 hb_ot_layout_table_get_lookup_count (hb_face_t *face,
197 hb_ot_layout_collect_lookups (hb_face_t *face,
199 const hb_tag_t *scripts,
200 const hb_tag_t *languages,
201 const hb_tag_t *features,
202 hb_set_t *lookup_indexes /* OUT */);
205 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
207 unsigned int lookup_index,
208 hb_set_t *glyphs_before, /* OUT. May be NULL */
209 hb_set_t *glyphs_input, /* OUT. May be NULL */
210 hb_set_t *glyphs_after, /* OUT. May be NULL */
211 hb_set_t *glyphs_output /* OUT. May be NULL */);
213 #ifdef HB_NOT_IMPLEMENTED
216 const hb_codepoint_t *before,
217 unsigned int before_length,
218 const hb_codepoint_t *input,
219 unsigned int input_length,
220 const hb_codepoint_t *after,
221 unsigned int after_length,
222 } hb_ot_layout_glyph_sequence_t;
225 (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
227 unsigned int lookup_index,
228 const hb_ot_layout_glyph_sequence_t *sequence,
232 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
234 unsigned int lookup_index,
235 hb_ot_layout_glyph_sequence_func_t callback,
245 hb_ot_layout_has_substitution (hb_face_t *face);
248 hb_ot_layout_lookup_would_substitute (hb_face_t *face,
249 unsigned int lookup_index,
250 const hb_codepoint_t *glyphs,
251 unsigned int glyphs_length,
252 hb_bool_t zero_context);
255 hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
256 unsigned int lookup_index,
258 /*TODO , hb_bool_t inclusive */);
260 #ifdef HB_NOT_IMPLEMENTED
261 /* Note: You better have GDEF when using this API, or marks won't do much. */
263 Xhb_ot_layout_lookup_substitute (hb_font_t *font,
264 unsigned int lookup_index,
265 const hb_ot_layout_glyph_sequence_t *sequence,
266 unsigned int out_size,
267 hb_codepoint_t *glyphs_out, /* OUT */
268 unsigned int *clusters_out, /* OUT */
269 unsigned int *out_length /* OUT */);
278 hb_ot_layout_has_positioning (hb_face_t *face);
280 #ifdef HB_NOT_IMPLEMENTED
281 /* Note: You better have GDEF when using this API, or marks won't do much. */
283 Xhb_ot_layout_lookup_position (hb_font_t *font,
284 unsigned int lookup_index,
285 const hb_ot_layout_glyph_sequence_t *sequence,
286 hb_glyph_position_t *positions /* IN / OUT */);
289 /* Optical 'size' feature info. Returns true if found.
290 * http://www.microsoft.com/typography/otspec/features_pt.htm#size */
292 hb_ot_layout_get_size_params (hb_face_t *face,
293 unsigned int *design_size, /* OUT. May be NULL */
294 unsigned int *subfamily_id, /* OUT. May be NULL */
295 unsigned int *subfamily_name_id, /* OUT. May be NULL */
296 unsigned int *range_start, /* OUT. May be NULL */
297 unsigned int *range_end /* OUT. May be NULL */);
302 #endif /* HB_OT_LAYOUT_H */