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')
51 hb_ot_layout_has_glyph_classes (hb_face_t *face);
54 HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0,
55 HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1,
56 HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2,
57 HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3,
58 HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
59 } hb_ot_layout_glyph_class_t;
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_get_glyphs_in_class (hb_face_t *face,
67 hb_ot_layout_glyph_class_t klass,
68 hb_set_t *glyphs /* OUT */);
71 /* Not that useful. Provides list of attach points for a glyph that a
72 * client may want to cache */
74 hb_ot_layout_get_attach_points (hb_face_t *face,
76 unsigned int start_offset,
77 unsigned int *point_count /* IN/OUT */,
78 unsigned int *point_array /* OUT */);
80 /* Ligature caret positions */
82 hb_ot_layout_get_ligature_carets (hb_font_t *font,
83 hb_direction_t direction,
85 unsigned int start_offset,
86 unsigned int *caret_count /* IN/OUT */,
87 hb_position_t *caret_array /* OUT */);
91 * GSUB/GPOS feature query and enumeration interface
94 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX ((unsigned int) 0xFFFF)
95 #define HB_OT_LAYOUT_NO_FEATURE_INDEX ((unsigned int) 0xFFFF)
96 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX ((unsigned int) 0xFFFF)
99 hb_ot_layout_table_get_script_tags (hb_face_t *face,
101 unsigned int start_offset,
102 unsigned int *script_count /* IN/OUT */,
103 hb_tag_t *script_tags /* OUT */);
106 hb_ot_layout_table_find_script (hb_face_t *face,
109 unsigned int *script_index);
111 /* Like find_script, but takes zero-terminated array of scripts to test */
113 hb_ot_layout_table_choose_script (hb_face_t *face,
115 const hb_tag_t *script_tags,
116 unsigned int *script_index,
117 hb_tag_t *chosen_script);
120 hb_ot_layout_table_get_feature_tags (hb_face_t *face,
122 unsigned int start_offset,
123 unsigned int *feature_count /* IN/OUT */,
124 hb_tag_t *feature_tags /* OUT */);
127 hb_ot_layout_script_get_language_tags (hb_face_t *face,
129 unsigned int script_index,
130 unsigned int start_offset,
131 unsigned int *language_count /* IN/OUT */,
132 hb_tag_t *language_tags /* OUT */);
135 hb_ot_layout_script_find_language (hb_face_t *face,
137 unsigned int script_index,
138 hb_tag_t language_tag,
139 unsigned int *language_index);
142 hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
144 unsigned int script_index,
145 unsigned int language_index,
146 unsigned int *feature_index);
149 hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
151 unsigned int script_index,
152 unsigned int language_index,
153 unsigned int start_offset,
154 unsigned int *feature_count /* IN/OUT */,
155 unsigned int *feature_indexes /* OUT */);
158 hb_ot_layout_language_get_feature_tags (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 hb_tag_t *feature_tags /* OUT */);
167 hb_ot_layout_language_find_feature (hb_face_t *face,
169 unsigned int script_index,
170 unsigned int language_index,
171 hb_tag_t feature_tag,
172 unsigned int *feature_index);
175 hb_ot_layout_feature_get_lookups (hb_face_t *face,
177 unsigned int feature_index,
178 unsigned int start_offset,
179 unsigned int *lookup_count /* IN/OUT */,
180 unsigned int *lookup_indexes /* OUT */);
183 hb_ot_layout_collect_lookups (hb_face_t *face,
185 const hb_tag_t *scripts,
186 const hb_tag_t *languages,
187 const hb_tag_t *features,
188 hb_set_t *lookup_indexes /* OUT */);
191 hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
193 hb_set_t *lookup_indexes /* OUT */);
196 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
198 unsigned int lookup_index,
199 hb_set_t *glyphs_before, /* OUT. May be NULL */
200 hb_set_t *glyphs_input, /* OUT. May be NULL */
201 hb_set_t *glyphs_after, /* OUT. May be NULL */
202 hb_set_t *glyphs_output /* OUT. May be NULL */);
204 #ifdef HB_NOT_IMPLEMENTED
207 const hb_codepoint_t *before,
208 unsigned int before_length,
209 const hb_codepoint_t *input,
210 unsigned int input_length,
211 const hb_codepoint_t *after,
212 unsigned int after_length,
213 } hb_ot_layout_glyph_sequence_t;
216 (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
218 unsigned int lookup_index,
219 const hb_ot_layout_glyph_sequence_t *sequence,
223 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
225 unsigned int lookup_index,
226 hb_ot_layout_glyph_sequence_func_t callback,
236 hb_ot_layout_has_substitution (hb_face_t *face);
239 hb_ot_layout_lookup_would_substitute (hb_face_t *face,
240 unsigned int lookup_index,
241 const hb_codepoint_t *glyphs,
242 unsigned int glyphs_length,
243 hb_bool_t zero_context);
246 hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
247 unsigned int lookup_index,
249 /*TODO , hb_bool_t inclusive */);
251 #ifdef HB_NOT_IMPLEMENTED
252 /* Note: You better have GDEF when using this API, or marks won't do much. */
254 Xhb_ot_layout_lookup_substitute (hb_font_t *font,
255 unsigned int lookup_index,
256 const hb_ot_layout_glyph_sequence_t *sequence,
257 unsigned int out_size,
258 hb_codepoint_t *glyphs_out, /* OUT */
259 unsigned int *clusters_out, /* OUT */
260 unsigned int *out_length /* OUT */);
269 hb_ot_layout_has_positioning (hb_face_t *face);
271 #ifdef HB_NOT_IMPLEMENTED
272 /* Note: You better have GDEF when using this API, or marks won't do much. */
274 Xhb_ot_layout_lookup_position (hb_font_t *font,
275 unsigned int lookup_index,
276 const hb_ot_layout_glyph_sequence_t *sequence,
277 hb_glyph_position_t *positions /* IN / OUT */);
280 /* Optical 'size' feature info. Returns true if found.
281 * http://www.microsoft.com/typography/otspec/features_pt.htm#size */
283 hb_ot_layout_get_size_params (hb_face_t *face,
284 unsigned int *design_size, /* OUT. May be NULL */
285 unsigned int *subfamily_id, /* OUT. May be NULL */
286 unsigned int *subfamily_name_id, /* OUT. May be NULL */
287 unsigned int *range_start, /* OUT. May be NULL */
288 unsigned int *range_end /* OUT. May be NULL */);
293 #endif /* HB_OT_LAYOUT_H */