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