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_BASE HB_TAG('B','A','S','E')
42 #define HB_OT_TAG_GDEF HB_TAG('G','D','E','F')
43 #define HB_OT_TAG_GSUB HB_TAG('G','S','U','B')
44 #define HB_OT_TAG_GPOS HB_TAG('G','P','O','S')
45 #define HB_OT_TAG_JSTF HB_TAG('J','S','T','F')
53 hb_ot_layout_has_glyph_classes (hb_face_t *face);
56 HB_OT_LAYOUT_GLYPH_CLASS_UNCLASSIFIED = 0,
57 HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH = 1,
58 HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE = 2,
59 HB_OT_LAYOUT_GLYPH_CLASS_MARK = 3,
60 HB_OT_LAYOUT_GLYPH_CLASS_COMPONENT = 4
61 } hb_ot_layout_glyph_class_t;
63 HB_EXTERN hb_ot_layout_glyph_class_t
64 hb_ot_layout_get_glyph_class (hb_face_t *face,
65 hb_codepoint_t glyph);
68 hb_ot_layout_get_glyphs_in_class (hb_face_t *face,
69 hb_ot_layout_glyph_class_t klass,
70 hb_set_t *glyphs /* OUT */);
73 /* Not that useful. Provides list of attach points for a glyph that a
74 * client may want to cache */
75 HB_EXTERN unsigned int
76 hb_ot_layout_get_attach_points (hb_face_t *face,
78 unsigned int start_offset,
79 unsigned int *point_count /* IN/OUT */,
80 unsigned int *point_array /* OUT */);
82 /* Ligature caret positions */
83 HB_EXTERN unsigned int
84 hb_ot_layout_get_ligature_carets (hb_font_t *font,
85 hb_direction_t direction,
87 unsigned int start_offset,
88 unsigned int *caret_count /* IN/OUT */,
89 hb_position_t *caret_array /* OUT */);
93 * GSUB/GPOS feature query and enumeration interface
96 #define HB_OT_LAYOUT_NO_SCRIPT_INDEX 0xFFFFu
97 #define HB_OT_LAYOUT_NO_FEATURE_INDEX 0xFFFFu
98 #define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX 0xFFFFu
99 #define HB_OT_LAYOUT_NO_VARIATIONS_INDEX 0xFFFFFFFFu
101 HB_EXTERN unsigned int
102 hb_ot_layout_table_get_script_tags (hb_face_t *face,
104 unsigned int start_offset,
105 unsigned int *script_count /* IN/OUT */,
106 hb_tag_t *script_tags /* OUT */);
109 hb_ot_layout_table_find_script (hb_face_t *face,
112 unsigned int *script_index);
114 /* Like find_script, but takes zero-terminated array of scripts to test */
116 hb_ot_layout_table_choose_script (hb_face_t *face,
118 const hb_tag_t *script_tags,
119 unsigned int *script_index,
120 hb_tag_t *chosen_script);
122 HB_EXTERN unsigned int
123 hb_ot_layout_table_get_feature_tags (hb_face_t *face,
125 unsigned int start_offset,
126 unsigned int *feature_count /* IN/OUT */,
127 hb_tag_t *feature_tags /* OUT */);
129 HB_EXTERN unsigned int
130 hb_ot_layout_script_get_language_tags (hb_face_t *face,
132 unsigned int script_index,
133 unsigned int start_offset,
134 unsigned int *language_count /* IN/OUT */,
135 hb_tag_t *language_tags /* OUT */);
138 hb_ot_layout_script_find_language (hb_face_t *face,
140 unsigned int script_index,
141 hb_tag_t language_tag,
142 unsigned int *language_index);
145 hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
147 unsigned int script_index,
148 unsigned int language_index,
149 unsigned int *feature_index);
152 hb_ot_layout_language_get_required_feature (hb_face_t *face,
154 unsigned int script_index,
155 unsigned int language_index,
156 unsigned int *feature_index,
157 hb_tag_t *feature_tag);
159 HB_EXTERN unsigned int
160 hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
162 unsigned int script_index,
163 unsigned int language_index,
164 unsigned int start_offset,
165 unsigned int *feature_count /* IN/OUT */,
166 unsigned int *feature_indexes /* OUT */);
168 HB_EXTERN unsigned int
169 hb_ot_layout_language_get_feature_tags (hb_face_t *face,
171 unsigned int script_index,
172 unsigned int language_index,
173 unsigned int start_offset,
174 unsigned int *feature_count /* IN/OUT */,
175 hb_tag_t *feature_tags /* OUT */);
178 hb_ot_layout_language_find_feature (hb_face_t *face,
180 unsigned int script_index,
181 unsigned int language_index,
182 hb_tag_t feature_tag,
183 unsigned int *feature_index);
185 HB_EXTERN unsigned int
186 hb_ot_layout_feature_get_lookups (hb_face_t *face,
188 unsigned int feature_index,
189 unsigned int start_offset,
190 unsigned int *lookup_count /* IN/OUT */,
191 unsigned int *lookup_indexes /* OUT */);
193 HB_EXTERN unsigned int
194 hb_ot_layout_table_get_lookup_count (hb_face_t *face,
199 hb_ot_layout_collect_lookups (hb_face_t *face,
201 const hb_tag_t *scripts,
202 const hb_tag_t *languages,
203 const hb_tag_t *features,
204 hb_set_t *lookup_indexes /* OUT */);
207 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
209 unsigned int lookup_index,
210 hb_set_t *glyphs_before, /* OUT. May be NULL */
211 hb_set_t *glyphs_input, /* OUT. May be NULL */
212 hb_set_t *glyphs_after, /* OUT. May be NULL */
213 hb_set_t *glyphs_output /* OUT. May be NULL */);
215 #ifdef HB_NOT_IMPLEMENTED
218 const hb_codepoint_t *before,
219 unsigned int before_length,
220 const hb_codepoint_t *input,
221 unsigned int input_length,
222 const hb_codepoint_t *after,
223 unsigned int after_length,
224 } hb_ot_layout_glyph_sequence_t;
227 (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
229 unsigned int lookup_index,
230 const hb_ot_layout_glyph_sequence_t *sequence,
234 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
236 unsigned int lookup_index,
237 hb_ot_layout_glyph_sequence_func_t callback,
241 /* Variations support */
244 hb_ot_layout_table_find_feature_variations (hb_face_t *face,
247 unsigned int num_coords,
248 unsigned int *variations_index /* out */);
250 HB_EXTERN unsigned int
251 hb_ot_layout_feature_with_variations_get_lookups (hb_face_t *face,
253 unsigned int feature_index,
254 unsigned int variations_index,
255 unsigned int start_offset,
256 unsigned int *lookup_count /* IN/OUT */,
257 unsigned int *lookup_indexes /* OUT */);
265 hb_ot_layout_has_substitution (hb_face_t *face);
268 hb_ot_layout_lookup_would_substitute (hb_face_t *face,
269 unsigned int lookup_index,
270 const hb_codepoint_t *glyphs,
271 unsigned int glyphs_length,
272 hb_bool_t zero_context);
275 hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
276 unsigned int lookup_index,
278 /*TODO , hb_bool_t inclusive */);
281 hb_ot_layout_lookups_substitute_closure (hb_face_t *face,
282 const hb_set_t *lookups,
286 #ifdef HB_NOT_IMPLEMENTED
287 /* Note: You better have GDEF when using this API, or marks won't do much. */
289 Xhb_ot_layout_lookup_substitute (hb_font_t *font,
290 unsigned int lookup_index,
291 const hb_ot_layout_glyph_sequence_t *sequence,
292 unsigned int out_size,
293 hb_codepoint_t *glyphs_out, /* OUT */
294 unsigned int *clusters_out, /* OUT */
295 unsigned int *out_length /* OUT */);
304 hb_ot_layout_has_positioning (hb_face_t *face);
306 #ifdef HB_NOT_IMPLEMENTED
307 /* Note: You better have GDEF when using this API, or marks won't do much. */
309 Xhb_ot_layout_lookup_position (hb_font_t *font,
310 unsigned int lookup_index,
311 const hb_ot_layout_glyph_sequence_t *sequence,
312 hb_glyph_position_t *positions /* IN / OUT */);
315 /* Optical 'size' feature info. Returns true if found.
316 * https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#size */
318 hb_ot_layout_get_size_params (hb_face_t *face,
319 unsigned int *design_size, /* OUT. May be NULL */
320 unsigned int *subfamily_id, /* OUT. May be NULL */
321 unsigned int *subfamily_name_id, /* OUT. May be NULL */
322 unsigned int *range_start, /* OUT. May be NULL */
323 unsigned int *range_end /* OUT. May be NULL */);
331 #define HB_OT_TAG_BASE_HANG HB_TAG('h','a','n','g')
332 #define HB_OT_TAG_BASE_ICFB HB_TAG('i','c','f','b')
333 #define HB_OT_TAG_BASE_ICFT HB_TAG('i','c','f','t')
334 #define HB_OT_TAG_BASE_IDEO HB_TAG('i','d','e','o')
335 #define HB_OT_TAG_BASE_IDTB HB_TAG('i','d','t','b')
336 #define HB_OT_TAG_BASE_MATH HB_TAG('m','a','t','h')
337 #define HB_OT_TAG_BASE_ROMN HB_TAG('r','o','m','n')
344 #endif /* HB_OT_LAYOUT_H */