• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright © 2009  Red Hat, Inc.
3  *
4  *  This is part of HarfBuzz, a text shaping library.
5  *
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.
11  *
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.
17  *
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.
23  *
24  * Red Hat Author(s): Behdad Esfahbod
25  */
26 
27 #ifndef HB_H_IN
28 #error "Include <hb.h> instead."
29 #endif
30 
31 #ifndef HB_FONT_H
32 #define HB_FONT_H
33 
34 #include "hb-common.h"
35 #include "hb-face.h"
36 
37 HB_BEGIN_DECLS
38 
39 
40 typedef struct hb_font_t hb_font_t;
41 
42 
43 /*
44  * hb_font_funcs_t
45  */
46 
47 typedef struct hb_font_funcs_t hb_font_funcs_t;
48 
49 HB_EXTERN hb_font_funcs_t *
50 hb_font_funcs_create (void);
51 
52 HB_EXTERN hb_font_funcs_t *
53 hb_font_funcs_get_empty (void);
54 
55 HB_EXTERN hb_font_funcs_t *
56 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
57 
58 HB_EXTERN void
59 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
60 
61 HB_EXTERN hb_bool_t
62 hb_font_funcs_set_user_data (hb_font_funcs_t    *ffuncs,
63 			     hb_user_data_key_t *key,
64 			     void *              data,
65 			     hb_destroy_func_t   destroy,
66 			     hb_bool_t           replace);
67 
68 
69 HB_EXTERN void *
70 hb_font_funcs_get_user_data (hb_font_funcs_t    *ffuncs,
71 			     hb_user_data_key_t *key);
72 
73 
74 HB_EXTERN void
75 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
76 
77 HB_EXTERN hb_bool_t
78 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
79 
80 
81 /* font and glyph extents */
82 
83 /* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
84 typedef struct hb_font_extents_t
85 {
86   hb_position_t ascender; /* typographic ascender. */
87   hb_position_t descender; /* typographic descender. */
88   hb_position_t line_gap; /* suggested line spacing gap. */
89   /*< private >*/
90   hb_position_t reserved9;
91   hb_position_t reserved8;
92   hb_position_t reserved7;
93   hb_position_t reserved6;
94   hb_position_t reserved5;
95   hb_position_t reserved4;
96   hb_position_t reserved3;
97   hb_position_t reserved2;
98   hb_position_t reserved1;
99 } hb_font_extents_t;
100 
101 /* Note that height is negative in coordinate systems that grow up. */
102 typedef struct hb_glyph_extents_t
103 {
104   hb_position_t x_bearing; /* left side of glyph from origin. */
105   hb_position_t y_bearing; /* top side of glyph from origin. */
106   hb_position_t width; /* distance from left to right side. */
107   hb_position_t height; /* distance from top to bottom side. */
108 } hb_glyph_extents_t;
109 
110 /* func types */
111 
112 typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
113 						       hb_font_extents_t *extents,
114 						       void *user_data);
115 typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
116 typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
117 
118 
119 typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
120 						       hb_codepoint_t unicode,
121 						       hb_codepoint_t *glyph,
122 						       void *user_data);
123 typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
124 							 hb_codepoint_t unicode, hb_codepoint_t variation_selector,
125 							 hb_codepoint_t *glyph,
126 							 void *user_data);
127 
128 typedef unsigned int (*hb_font_get_nominal_glyphs_func_t) (hb_font_t *font, void *font_data,
129 							   unsigned int count,
130 							   const hb_codepoint_t *first_unicode,
131 							   unsigned int unicode_stride,
132 							   hb_codepoint_t *first_glyph,
133 							   unsigned int glyph_stride,
134 							   void *user_data);
135 
136 
137 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
138 							   hb_codepoint_t glyph,
139 							   void *user_data);
140 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
141 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
142 
143 typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,
144 						   unsigned int count,
145 						   const hb_codepoint_t *first_glyph,
146 						   unsigned glyph_stride,
147 						   hb_position_t *first_advance,
148 						   unsigned advance_stride,
149 						   void *user_data);
150 typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t;
151 typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t;
152 
153 typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
154 						      hb_codepoint_t glyph,
155 						      hb_position_t *x, hb_position_t *y,
156 						      void *user_data);
157 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
158 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
159 
160 typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
161 							   hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
162 							   void *user_data);
163 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
164 
165 
166 typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,
167 						       hb_codepoint_t glyph,
168 						       hb_glyph_extents_t *extents,
169 						       void *user_data);
170 typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,
171 							     hb_codepoint_t glyph, unsigned int point_index,
172 							     hb_position_t *x, hb_position_t *y,
173 							     void *user_data);
174 
175 
176 typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,
177 						    hb_codepoint_t glyph,
178 						    char *name, unsigned int size,
179 						    void *user_data);
180 typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,
181 							 const char *name, int len, /* -1 means nul-terminated */
182 							 hb_codepoint_t *glyph,
183 							 void *user_data);
184 
185 
186 /* func setters */
187 
188 /**
189  * hb_font_funcs_set_font_h_extents_func:
190  * @ffuncs: font functions.
191  * @func: (closure user_data) (destroy destroy) (scope notified):
192  * @user_data:
193  * @destroy:
194  *
195  *
196  *
197  * Since: 1.1.2
198  **/
199 HB_EXTERN void
200 hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
201 				       hb_font_get_font_h_extents_func_t func,
202 				       void *user_data, hb_destroy_func_t destroy);
203 
204 /**
205  * hb_font_funcs_set_font_v_extents_func:
206  * @ffuncs: font functions.
207  * @func: (closure user_data) (destroy destroy) (scope notified):
208  * @user_data:
209  * @destroy:
210  *
211  *
212  *
213  * Since: 1.1.2
214  **/
215 HB_EXTERN void
216 hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
217 				       hb_font_get_font_v_extents_func_t func,
218 				       void *user_data, hb_destroy_func_t destroy);
219 
220 /**
221  * hb_font_funcs_set_nominal_glyph_func:
222  * @ffuncs: font functions.
223  * @func: (closure user_data) (destroy destroy) (scope notified):
224  * @user_data:
225  * @destroy:
226  *
227  *
228  *
229  * Since: 1.2.3
230  **/
231 HB_EXTERN void
232 hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
233 				      hb_font_get_nominal_glyph_func_t func,
234 				      void *user_data, hb_destroy_func_t destroy);
235 
236 /**
237  * hb_font_funcs_set_nominal_glyphs_func:
238  * @ffuncs: font functions.
239  * @func: (closure user_data) (destroy destroy) (scope notified):
240  * @user_data:
241  * @destroy:
242  *
243  *
244  *
245  * Since: 2.0.0
246  **/
247 HB_EXTERN void
248 hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs,
249 				       hb_font_get_nominal_glyphs_func_t func,
250 				       void *user_data, hb_destroy_func_t destroy);
251 
252 /**
253  * hb_font_funcs_set_variation_glyph_func:
254  * @ffuncs: font functions.
255  * @func: (closure user_data) (destroy destroy) (scope notified):
256  * @user_data:
257  * @destroy:
258  *
259  *
260  *
261  * Since: 1.2.3
262  **/
263 HB_EXTERN void
264 hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
265 					hb_font_get_variation_glyph_func_t func,
266 					void *user_data, hb_destroy_func_t destroy);
267 
268 /**
269  * hb_font_funcs_set_glyph_h_advance_func:
270  * @ffuncs: font functions.
271  * @func: (closure user_data) (destroy destroy) (scope notified):
272  * @user_data:
273  * @destroy:
274  *
275  *
276  *
277  * Since: 0.9.2
278  **/
279 HB_EXTERN void
280 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
281 					hb_font_get_glyph_h_advance_func_t func,
282 					void *user_data, hb_destroy_func_t destroy);
283 
284 /**
285  * hb_font_funcs_set_glyph_v_advance_func:
286  * @ffuncs: font functions.
287  * @func: (closure user_data) (destroy destroy) (scope notified):
288  * @user_data:
289  * @destroy:
290  *
291  *
292  *
293  * Since: 0.9.2
294  **/
295 HB_EXTERN void
296 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
297 					hb_font_get_glyph_v_advance_func_t func,
298 					void *user_data, hb_destroy_func_t destroy);
299 
300 /**
301  * hb_font_funcs_set_glyph_h_advances_func:
302  * @ffuncs: font functions.
303  * @func: (closure user_data) (destroy destroy) (scope notified):
304  * @user_data:
305  * @destroy:
306  *
307  *
308  *
309  * Since: 1.8.6
310  **/
311 HB_EXTERN void
312 hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,
313 					hb_font_get_glyph_h_advances_func_t func,
314 					void *user_data, hb_destroy_func_t destroy);
315 
316 /**
317  * hb_font_funcs_set_glyph_v_advances_func:
318  * @ffuncs: font functions.
319  * @func: (closure user_data) (destroy destroy) (scope notified):
320  * @user_data:
321  * @destroy:
322  *
323  *
324  *
325  * Since: 1.8.6
326  **/
327 HB_EXTERN void
328 hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs,
329 					hb_font_get_glyph_v_advances_func_t func,
330 					void *user_data, hb_destroy_func_t destroy);
331 
332 /**
333  * hb_font_funcs_set_glyph_h_origin_func:
334  * @ffuncs: font functions.
335  * @func: (closure user_data) (destroy destroy) (scope notified):
336  * @user_data:
337  * @destroy:
338  *
339  *
340  *
341  * Since: 0.9.2
342  **/
343 HB_EXTERN void
344 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
345 				       hb_font_get_glyph_h_origin_func_t func,
346 				       void *user_data, hb_destroy_func_t destroy);
347 
348 /**
349  * hb_font_funcs_set_glyph_v_origin_func:
350  * @ffuncs: font functions.
351  * @func: (closure user_data) (destroy destroy) (scope notified):
352  * @user_data:
353  * @destroy:
354  *
355  *
356  *
357  * Since: 0.9.2
358  **/
359 HB_EXTERN void
360 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
361 				       hb_font_get_glyph_v_origin_func_t func,
362 				       void *user_data, hb_destroy_func_t destroy);
363 
364 /**
365  * hb_font_funcs_set_glyph_h_kerning_func:
366  * @ffuncs: font functions.
367  * @func: (closure user_data) (destroy destroy) (scope notified):
368  * @user_data:
369  * @destroy:
370  *
371  *
372  *
373  * Since: 0.9.2
374  **/
375 HB_EXTERN void
376 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
377 					hb_font_get_glyph_h_kerning_func_t func,
378 					void *user_data, hb_destroy_func_t destroy);
379 
380 /**
381  * hb_font_funcs_set_glyph_extents_func:
382  * @ffuncs: font functions.
383  * @func: (closure user_data) (destroy destroy) (scope notified):
384  * @user_data:
385  * @destroy:
386  *
387  *
388  *
389  * Since: 0.9.2
390  **/
391 HB_EXTERN void
392 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
393 				      hb_font_get_glyph_extents_func_t func,
394 				      void *user_data, hb_destroy_func_t destroy);
395 
396 /**
397  * hb_font_funcs_set_glyph_contour_point_func:
398  * @ffuncs: font functions.
399  * @func: (closure user_data) (destroy destroy) (scope notified):
400  * @user_data:
401  * @destroy:
402  *
403  *
404  *
405  * Since: 0.9.2
406  **/
407 HB_EXTERN void
408 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
409 					    hb_font_get_glyph_contour_point_func_t func,
410 					    void *user_data, hb_destroy_func_t destroy);
411 
412 /**
413  * hb_font_funcs_set_glyph_name_func:
414  * @ffuncs: font functions.
415  * @func: (closure user_data) (destroy destroy) (scope notified):
416  * @user_data:
417  * @destroy:
418  *
419  *
420  *
421  * Since: 0.9.2
422  **/
423 HB_EXTERN void
424 hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
425 				   hb_font_get_glyph_name_func_t func,
426 				   void *user_data, hb_destroy_func_t destroy);
427 
428 /**
429  * hb_font_funcs_set_glyph_from_name_func:
430  * @ffuncs: font functions.
431  * @func: (closure user_data) (destroy destroy) (scope notified):
432  * @user_data:
433  * @destroy:
434  *
435  *
436  *
437  * Since: 0.9.2
438  **/
439 HB_EXTERN void
440 hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
441 					hb_font_get_glyph_from_name_func_t func,
442 					void *user_data, hb_destroy_func_t destroy);
443 
444 /* func dispatch */
445 
446 HB_EXTERN hb_bool_t
447 hb_font_get_h_extents (hb_font_t *font,
448 		       hb_font_extents_t *extents);
449 HB_EXTERN hb_bool_t
450 hb_font_get_v_extents (hb_font_t *font,
451 		       hb_font_extents_t *extents);
452 
453 HB_EXTERN hb_bool_t
454 hb_font_get_nominal_glyph (hb_font_t *font,
455 			   hb_codepoint_t unicode,
456 			   hb_codepoint_t *glyph);
457 HB_EXTERN hb_bool_t
458 hb_font_get_variation_glyph (hb_font_t *font,
459 			     hb_codepoint_t unicode, hb_codepoint_t variation_selector,
460 			     hb_codepoint_t *glyph);
461 
462 HB_EXTERN unsigned int
463 hb_font_get_nominal_glyphs (hb_font_t *font,
464 			    unsigned int count,
465 			    const hb_codepoint_t *first_unicode,
466 			    unsigned int unicode_stride,
467 			    hb_codepoint_t *first_glyph,
468 			    unsigned int glyph_stride);
469 
470 HB_EXTERN hb_position_t
471 hb_font_get_glyph_h_advance (hb_font_t *font,
472 			     hb_codepoint_t glyph);
473 HB_EXTERN hb_position_t
474 hb_font_get_glyph_v_advance (hb_font_t *font,
475 			     hb_codepoint_t glyph);
476 
477 HB_EXTERN void
478 hb_font_get_glyph_h_advances (hb_font_t* font,
479 			      unsigned int count,
480 			      const hb_codepoint_t *first_glyph,
481 			      unsigned glyph_stride,
482 			      hb_position_t *first_advance,
483 			      unsigned advance_stride);
484 HB_EXTERN void
485 hb_font_get_glyph_v_advances (hb_font_t* font,
486 			      unsigned int count,
487 			      const hb_codepoint_t *first_glyph,
488 			      unsigned glyph_stride,
489 			      hb_position_t *first_advance,
490 			      unsigned advance_stride);
491 
492 HB_EXTERN hb_bool_t
493 hb_font_get_glyph_h_origin (hb_font_t *font,
494 			    hb_codepoint_t glyph,
495 			    hb_position_t *x, hb_position_t *y);
496 HB_EXTERN hb_bool_t
497 hb_font_get_glyph_v_origin (hb_font_t *font,
498 			    hb_codepoint_t glyph,
499 			    hb_position_t *x, hb_position_t *y);
500 
501 HB_EXTERN hb_position_t
502 hb_font_get_glyph_h_kerning (hb_font_t *font,
503 			     hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
504 
505 HB_EXTERN hb_bool_t
506 hb_font_get_glyph_extents (hb_font_t *font,
507 			   hb_codepoint_t glyph,
508 			   hb_glyph_extents_t *extents);
509 
510 HB_EXTERN hb_bool_t
511 hb_font_get_glyph_contour_point (hb_font_t *font,
512 				 hb_codepoint_t glyph, unsigned int point_index,
513 				 hb_position_t *x, hb_position_t *y);
514 
515 HB_EXTERN hb_bool_t
516 hb_font_get_glyph_name (hb_font_t *font,
517 			hb_codepoint_t glyph,
518 			char *name, unsigned int size);
519 HB_EXTERN hb_bool_t
520 hb_font_get_glyph_from_name (hb_font_t *font,
521 			     const char *name, int len, /* -1 means nul-terminated */
522 			     hb_codepoint_t *glyph);
523 
524 
525 /* high-level funcs, with fallback */
526 
527 /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
528  * otherwise calls hb_font_get_variation_glyph(). */
529 HB_EXTERN hb_bool_t
530 hb_font_get_glyph (hb_font_t *font,
531 		   hb_codepoint_t unicode, hb_codepoint_t variation_selector,
532 		   hb_codepoint_t *glyph);
533 
534 HB_EXTERN void
535 hb_font_get_extents_for_direction (hb_font_t *font,
536 				   hb_direction_t direction,
537 				   hb_font_extents_t *extents);
538 HB_EXTERN void
539 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
540 					 hb_codepoint_t glyph,
541 					 hb_direction_t direction,
542 					 hb_position_t *x, hb_position_t *y);
543 HB_EXTERN void
544 hb_font_get_glyph_advances_for_direction (hb_font_t* font,
545 					  hb_direction_t direction,
546 					  unsigned int count,
547 					  const hb_codepoint_t *first_glyph,
548 					  unsigned glyph_stride,
549 					  hb_position_t *first_advance,
550 					  unsigned advance_stride);
551 HB_EXTERN void
552 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
553 					hb_codepoint_t glyph,
554 					hb_direction_t direction,
555 					hb_position_t *x, hb_position_t *y);
556 HB_EXTERN void
557 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
558 					hb_codepoint_t glyph,
559 					hb_direction_t direction,
560 					hb_position_t *x, hb_position_t *y);
561 HB_EXTERN void
562 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
563 					     hb_codepoint_t glyph,
564 					     hb_direction_t direction,
565 					     hb_position_t *x, hb_position_t *y);
566 
567 HB_EXTERN void
568 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
569 					 hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
570 					 hb_direction_t direction,
571 					 hb_position_t *x, hb_position_t *y);
572 
573 HB_EXTERN hb_bool_t
574 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
575 				      hb_codepoint_t glyph,
576 				      hb_direction_t direction,
577 				      hb_glyph_extents_t *extents);
578 
579 HB_EXTERN hb_bool_t
580 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
581 					    hb_codepoint_t glyph, unsigned int point_index,
582 					    hb_direction_t direction,
583 					    hb_position_t *x, hb_position_t *y);
584 
585 /* Generates gidDDD if glyph has no name. */
586 HB_EXTERN void
587 hb_font_glyph_to_string (hb_font_t *font,
588 			 hb_codepoint_t glyph,
589 			 char *s, unsigned int size);
590 /* Parses gidDDD and uniUUUU strings automatically. */
591 HB_EXTERN hb_bool_t
592 hb_font_glyph_from_string (hb_font_t *font,
593 			   const char *s, int len, /* -1 means nul-terminated */
594 			   hb_codepoint_t *glyph);
595 
596 
597 /*
598  * hb_font_t
599  */
600 
601 /* Fonts are very light-weight objects */
602 
603 HB_EXTERN hb_font_t *
604 hb_font_create (hb_face_t *face);
605 
606 HB_EXTERN hb_font_t *
607 hb_font_create_sub_font (hb_font_t *parent);
608 
609 HB_EXTERN hb_font_t *
610 hb_font_get_empty (void);
611 
612 HB_EXTERN hb_font_t *
613 hb_font_reference (hb_font_t *font);
614 
615 HB_EXTERN void
616 hb_font_destroy (hb_font_t *font);
617 
618 HB_EXTERN hb_bool_t
619 hb_font_set_user_data (hb_font_t          *font,
620 		       hb_user_data_key_t *key,
621 		       void *              data,
622 		       hb_destroy_func_t   destroy,
623 		       hb_bool_t           replace);
624 
625 
626 HB_EXTERN void *
627 hb_font_get_user_data (hb_font_t          *font,
628 		       hb_user_data_key_t *key);
629 
630 HB_EXTERN void
631 hb_font_make_immutable (hb_font_t *font);
632 
633 HB_EXTERN hb_bool_t
634 hb_font_is_immutable (hb_font_t *font);
635 
636 HB_EXTERN void
637 hb_font_set_parent (hb_font_t *font,
638 		    hb_font_t *parent);
639 
640 HB_EXTERN hb_font_t *
641 hb_font_get_parent (hb_font_t *font);
642 
643 HB_EXTERN void
644 hb_font_set_face (hb_font_t *font,
645 		  hb_face_t *face);
646 
647 HB_EXTERN hb_face_t *
648 hb_font_get_face (hb_font_t *font);
649 
650 
651 HB_EXTERN void
652 hb_font_set_funcs (hb_font_t         *font,
653 		   hb_font_funcs_t   *klass,
654 		   void              *font_data,
655 		   hb_destroy_func_t  destroy);
656 
657 /* Be *very* careful with this function! */
658 HB_EXTERN void
659 hb_font_set_funcs_data (hb_font_t         *font,
660 			void              *font_data,
661 			hb_destroy_func_t  destroy);
662 
663 
664 HB_EXTERN void
665 hb_font_set_scale (hb_font_t *font,
666 		   int x_scale,
667 		   int y_scale);
668 
669 HB_EXTERN void
670 hb_font_get_scale (hb_font_t *font,
671 		   int *x_scale,
672 		   int *y_scale);
673 
674 /*
675  * A zero value means "no hinting in that direction"
676  */
677 HB_EXTERN void
678 hb_font_set_ppem (hb_font_t *font,
679 		  unsigned int x_ppem,
680 		  unsigned int y_ppem);
681 
682 HB_EXTERN void
683 hb_font_get_ppem (hb_font_t *font,
684 		  unsigned int *x_ppem,
685 		  unsigned int *y_ppem);
686 
687 /*
688  * Point size per EM.  Used for optical-sizing in CoreText.
689  * A value of zero means "not set".
690  */
691 HB_EXTERN void
692 hb_font_set_ptem (hb_font_t *font, float ptem);
693 
694 HB_EXTERN float
695 hb_font_get_ptem (hb_font_t *font);
696 
697 HB_EXTERN void
698 hb_font_set_variations (hb_font_t *font,
699 			const hb_variation_t *variations,
700 			unsigned int variations_length);
701 
702 HB_EXTERN void
703 hb_font_set_var_coords_design (hb_font_t *font,
704 			       const float *coords,
705 			       unsigned int coords_length);
706 
707 HB_EXTERN void
708 hb_font_set_var_coords_normalized (hb_font_t *font,
709 				   const int *coords, /* 2.14 normalized */
710 				   unsigned int coords_length);
711 
712 HB_EXTERN const int *
713 hb_font_get_var_coords_normalized (hb_font_t *font,
714 				   unsigned int *length);
715 
716 HB_EXTERN void
717 hb_font_set_var_named_instance (hb_font_t *font,
718 				unsigned instance_index);
719 
720 HB_END_DECLS
721 
722 #endif /* HB_FONT_H */
723