cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / third_party / harfbuzz-ng / src / hb-ot-layout.h
blob134f1a6c16422716b3b7508fa64bc3f93d42ce83
1 /*
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
16 * DAMAGE.
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_H_IN
28 #error "Include <hb-ot.h> instead."
29 #endif
31 #ifndef HB_OT_LAYOUT_H
32 #define HB_OT_LAYOUT_H
34 #include "hb.h"
36 #include "hb-ot-tag.h"
38 HB_BEGIN_DECLS
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')
47 * GDEF
50 hb_bool_t
51 hb_ot_layout_has_glyph_classes (hb_face_t *face);
53 typedef enum {
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);
65 void
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 */
73 unsigned int
74 hb_ot_layout_get_attach_points (hb_face_t *face,
75 hb_codepoint_t glyph,
76 unsigned int start_offset,
77 unsigned int *point_count /* IN/OUT */,
78 unsigned int *point_array /* OUT */);
80 /* Ligature caret positions */
81 unsigned int
82 hb_ot_layout_get_ligature_carets (hb_font_t *font,
83 hb_direction_t direction,
84 hb_codepoint_t glyph,
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)
98 unsigned int
99 hb_ot_layout_table_get_script_tags (hb_face_t *face,
100 hb_tag_t table_tag,
101 unsigned int start_offset,
102 unsigned int *script_count /* IN/OUT */,
103 hb_tag_t *script_tags /* OUT */);
105 hb_bool_t
106 hb_ot_layout_table_find_script (hb_face_t *face,
107 hb_tag_t table_tag,
108 hb_tag_t script_tag,
109 unsigned int *script_index);
111 /* Like find_script, but takes zero-terminated array of scripts to test */
112 hb_bool_t
113 hb_ot_layout_table_choose_script (hb_face_t *face,
114 hb_tag_t table_tag,
115 const hb_tag_t *script_tags,
116 unsigned int *script_index,
117 hb_tag_t *chosen_script);
119 unsigned int
120 hb_ot_layout_table_get_feature_tags (hb_face_t *face,
121 hb_tag_t table_tag,
122 unsigned int start_offset,
123 unsigned int *feature_count /* IN/OUT */,
124 hb_tag_t *feature_tags /* OUT */);
126 unsigned int
127 hb_ot_layout_script_get_language_tags (hb_face_t *face,
128 hb_tag_t table_tag,
129 unsigned int script_index,
130 unsigned int start_offset,
131 unsigned int *language_count /* IN/OUT */,
132 hb_tag_t *language_tags /* OUT */);
134 hb_bool_t
135 hb_ot_layout_script_find_language (hb_face_t *face,
136 hb_tag_t table_tag,
137 unsigned int script_index,
138 hb_tag_t language_tag,
139 unsigned int *language_index);
141 hb_bool_t
142 hb_ot_layout_language_get_required_feature_index (hb_face_t *face,
143 hb_tag_t table_tag,
144 unsigned int script_index,
145 unsigned int language_index,
146 unsigned int *feature_index);
148 unsigned int
149 hb_ot_layout_language_get_feature_indexes (hb_face_t *face,
150 hb_tag_t table_tag,
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 */);
157 unsigned int
158 hb_ot_layout_language_get_feature_tags (hb_face_t *face,
159 hb_tag_t table_tag,
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 */);
166 hb_bool_t
167 hb_ot_layout_language_find_feature (hb_face_t *face,
168 hb_tag_t table_tag,
169 unsigned int script_index,
170 unsigned int language_index,
171 hb_tag_t feature_tag,
172 unsigned int *feature_index);
174 unsigned int
175 hb_ot_layout_feature_get_lookups (hb_face_t *face,
176 hb_tag_t table_tag,
177 unsigned int feature_index,
178 unsigned int start_offset,
179 unsigned int *lookup_count /* IN/OUT */,
180 unsigned int *lookup_indexes /* OUT */);
182 void
183 hb_ot_layout_collect_lookups (hb_face_t *face,
184 hb_tag_t table_tag,
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 */);
190 void
191 hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
192 hb_tag_t table_tag,
193 hb_set_t *lookup_indexes /* OUT */);
195 void
196 hb_ot_layout_lookup_collect_glyphs (hb_face_t *face,
197 hb_tag_t table_tag,
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
205 typedef struct
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;
215 typedef hb_bool_t
216 (*hb_ot_layout_glyph_sequence_func_t) (hb_font_t *font,
217 hb_tag_t table_tag,
218 unsigned int lookup_index,
219 const hb_ot_layout_glyph_sequence_t *sequence,
220 void *user_data);
222 void
223 Xhb_ot_layout_lookup_enumerate_sequences (hb_face_t *face,
224 hb_tag_t table_tag,
225 unsigned int lookup_index,
226 hb_ot_layout_glyph_sequence_func_t callback,
227 void *user_data);
228 #endif
232 * GSUB
235 hb_bool_t
236 hb_ot_layout_has_substitution (hb_face_t *face);
238 hb_bool_t
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);
245 void
246 hb_ot_layout_lookup_substitute_closure (hb_face_t *face,
247 unsigned int lookup_index,
248 hb_set_t *glyphs
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. */
253 hb_bool_t
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 */);
261 #endif
265 * GPOS
268 hb_bool_t
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. */
273 hb_bool_t
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 */);
278 #endif
280 /* Optical 'size' feature info. Returns true if found.
281 * http://www.microsoft.com/typography/otspec/features_pt.htm#size */
282 hb_bool_t
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 */);
291 HB_END_DECLS
293 #endif /* HB_OT_LAYOUT_H */