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