2 * Copyright © 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.h> instead."
34 #include "hb-common.h"
40 typedef struct _hb_face_t hb_face_t;
41 typedef struct _hb_font_t hb_font_t;
48 hb_face_create (hb_blob_t *blob,
51 typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data);
53 /* calls destroy() when not needing user_data anymore */
55 hb_face_create_for_tables (hb_reference_table_func_t reference_table,
57 hb_destroy_func_t destroy);
60 hb_face_get_empty (void);
63 hb_face_reference (hb_face_t *face);
66 hb_face_destroy (hb_face_t *face);
69 hb_face_set_user_data (hb_face_t *face,
70 hb_user_data_key_t *key,
72 hb_destroy_func_t destroy,
77 hb_face_get_user_data (hb_face_t *face,
78 hb_user_data_key_t *key);
81 hb_face_make_immutable (hb_face_t *face);
84 hb_face_is_immutable (hb_face_t *face);
88 hb_face_reference_table (hb_face_t *face,
92 hb_face_reference_blob (hb_face_t *face);
95 hb_face_set_index (hb_face_t *face,
99 hb_face_get_index (hb_face_t *face);
102 hb_face_set_upem (hb_face_t *face,
106 hb_face_get_upem (hb_face_t *face);
113 typedef struct _hb_font_funcs_t hb_font_funcs_t;
116 hb_font_funcs_create (void);
119 hb_font_funcs_get_empty (void);
122 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
125 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
128 hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
129 hb_user_data_key_t *key,
131 hb_destroy_func_t destroy,
136 hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
137 hb_user_data_key_t *key);
141 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
144 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
148 typedef struct _hb_glyph_extents_t
150 hb_position_t x_bearing;
151 hb_position_t y_bearing;
153 hb_position_t height;
154 } hb_glyph_extents_t;
159 typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
160 hb_codepoint_t unicode, hb_codepoint_t variation_selector,
161 hb_codepoint_t *glyph,
165 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
166 hb_codepoint_t glyph,
168 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
169 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
171 typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
172 hb_codepoint_t glyph,
173 hb_position_t *x, hb_position_t *y,
175 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
176 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
178 typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
179 hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
181 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
182 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
185 typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,
186 hb_codepoint_t glyph,
187 hb_glyph_extents_t *extents,
189 typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,
190 hb_codepoint_t glyph, unsigned int point_index,
191 hb_position_t *x, hb_position_t *y,
195 typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,
196 hb_codepoint_t glyph,
197 char *name, unsigned int size,
199 typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,
200 const char *name, int len, /* -1 means nul-terminated */
201 hb_codepoint_t *glyph,
208 hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
209 hb_font_get_glyph_func_t glyph_func,
210 void *user_data, hb_destroy_func_t destroy);
213 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
214 hb_font_get_glyph_h_advance_func_t func,
215 void *user_data, hb_destroy_func_t destroy);
217 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
218 hb_font_get_glyph_v_advance_func_t func,
219 void *user_data, hb_destroy_func_t destroy);
222 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
223 hb_font_get_glyph_h_origin_func_t func,
224 void *user_data, hb_destroy_func_t destroy);
226 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
227 hb_font_get_glyph_v_origin_func_t func,
228 void *user_data, hb_destroy_func_t destroy);
231 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
232 hb_font_get_glyph_h_kerning_func_t func,
233 void *user_data, hb_destroy_func_t destroy);
235 hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
236 hb_font_get_glyph_v_kerning_func_t func,
237 void *user_data, hb_destroy_func_t destroy);
240 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
241 hb_font_get_glyph_extents_func_t func,
242 void *user_data, hb_destroy_func_t destroy);
244 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
245 hb_font_get_glyph_contour_point_func_t func,
246 void *user_data, hb_destroy_func_t destroy);
249 hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
250 hb_font_get_glyph_name_func_t glyph_func,
251 void *user_data, hb_destroy_func_t destroy);
253 hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
254 hb_font_get_glyph_from_name_func_t glyph_func,
255 void *user_data, hb_destroy_func_t destroy);
261 hb_font_get_glyph (hb_font_t *font,
262 hb_codepoint_t unicode, hb_codepoint_t variation_selector,
263 hb_codepoint_t *glyph);
266 hb_font_get_glyph_h_advance (hb_font_t *font,
267 hb_codepoint_t glyph);
269 hb_font_get_glyph_v_advance (hb_font_t *font,
270 hb_codepoint_t glyph);
273 hb_font_get_glyph_h_origin (hb_font_t *font,
274 hb_codepoint_t glyph,
275 hb_position_t *x, hb_position_t *y);
277 hb_font_get_glyph_v_origin (hb_font_t *font,
278 hb_codepoint_t glyph,
279 hb_position_t *x, hb_position_t *y);
282 hb_font_get_glyph_h_kerning (hb_font_t *font,
283 hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
285 hb_font_get_glyph_v_kerning (hb_font_t *font,
286 hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph);
289 hb_font_get_glyph_extents (hb_font_t *font,
290 hb_codepoint_t glyph,
291 hb_glyph_extents_t *extents);
294 hb_font_get_glyph_contour_point (hb_font_t *font,
295 hb_codepoint_t glyph, unsigned int point_index,
296 hb_position_t *x, hb_position_t *y);
299 hb_font_get_glyph_name (hb_font_t *font,
300 hb_codepoint_t glyph,
301 char *name, unsigned int size);
303 hb_font_get_glyph_from_name (hb_font_t *font,
304 const char *name, int len, /* -1 means nul-terminated */
305 hb_codepoint_t *glyph);
308 /* high-level funcs, with fallback */
311 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
312 hb_codepoint_t glyph,
313 hb_direction_t direction,
314 hb_position_t *x, hb_position_t *y);
316 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
317 hb_codepoint_t glyph,
318 hb_direction_t direction,
319 hb_position_t *x, hb_position_t *y);
321 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
322 hb_codepoint_t glyph,
323 hb_direction_t direction,
324 hb_position_t *x, hb_position_t *y);
326 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
327 hb_codepoint_t glyph,
328 hb_direction_t direction,
329 hb_position_t *x, hb_position_t *y);
332 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
333 hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
334 hb_direction_t direction,
335 hb_position_t *x, hb_position_t *y);
338 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
339 hb_codepoint_t glyph,
340 hb_direction_t direction,
341 hb_glyph_extents_t *extents);
344 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
345 hb_codepoint_t glyph, unsigned int point_index,
346 hb_direction_t direction,
347 hb_position_t *x, hb_position_t *y);
354 /* Fonts are very light-weight objects */
357 hb_font_create (hb_face_t *face);
360 hb_font_create_sub_font (hb_font_t *parent);
363 hb_font_get_empty (void);
366 hb_font_reference (hb_font_t *font);
369 hb_font_destroy (hb_font_t *font);
372 hb_font_set_user_data (hb_font_t *font,
373 hb_user_data_key_t *key,
375 hb_destroy_func_t destroy,
380 hb_font_get_user_data (hb_font_t *font,
381 hb_user_data_key_t *key);
384 hb_font_make_immutable (hb_font_t *font);
387 hb_font_is_immutable (hb_font_t *font);
390 hb_font_get_parent (hb_font_t *font);
393 hb_font_get_face (hb_font_t *font);
397 hb_font_set_funcs (hb_font_t *font,
398 hb_font_funcs_t *klass,
400 hb_destroy_func_t destroy);
402 /* Be *very* careful with this function! */
404 hb_font_set_funcs_data (hb_font_t *font,
406 hb_destroy_func_t destroy);
410 hb_font_set_scale (hb_font_t *font,
415 hb_font_get_scale (hb_font_t *font,
420 * A zero value means "no hinting in that direction"
423 hb_font_set_ppem (hb_font_t *font,
425 unsigned int y_ppem);
428 hb_font_get_ppem (hb_font_t *font,
429 unsigned int *x_ppem,
430 unsigned int *y_ppem);
435 #endif /* HB_FONT_H */