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 *metrics, |
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 | |
129 | typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data, |
130 | hb_codepoint_t glyph, |
131 | void *user_data); |
132 | typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t; |
133 | typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t; |
134 | |
135 | typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data, |
136 | unsigned count, |
137 | hb_codepoint_t *first_glyph, |
138 | unsigned glyph_stride, |
139 | hb_position_t *first_advance, |
140 | unsigned advance_stride, |
141 | void *user_data); |
142 | typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t; |
143 | typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t; |
144 | |
145 | typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data, |
146 | hb_codepoint_t glyph, |
147 | hb_position_t *x, hb_position_t *y, |
148 | void *user_data); |
149 | typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t; |
150 | typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t; |
151 | |
152 | typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data, |
153 | hb_codepoint_t first_glyph, hb_codepoint_t second_glyph, |
154 | void *user_data); |
155 | typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t; |
156 | typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t; |
157 | |
158 | |
159 | typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data, |
160 | hb_codepoint_t glyph, |
161 | hb_glyph_extents_t *extents, |
162 | void *user_data); |
163 | typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data, |
164 | hb_codepoint_t glyph, unsigned int point_index, |
165 | hb_position_t *x, hb_position_t *y, |
166 | void *user_data); |
167 | |
168 | |
169 | typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data, |
170 | hb_codepoint_t glyph, |
171 | char *name, unsigned int size, |
172 | void *user_data); |
173 | typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data, |
174 | const char *name, int len, /* -1 means nul-terminated */ |
175 | hb_codepoint_t *glyph, |
176 | void *user_data); |
177 | |
178 | |
179 | /* func setters */ |
180 | |
181 | /** |
182 | * hb_font_funcs_set_font_h_extents_func: |
183 | * @ffuncs: font functions. |
184 | * @func: (closure user_data) (destroy destroy) (scope notified): |
185 | * @user_data: |
186 | * @destroy: |
187 | * |
188 | * |
189 | * |
190 | * Since: 1.1.2 |
191 | **/ |
192 | HB_EXTERN void |
193 | hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs, |
194 | hb_font_get_font_h_extents_func_t func, |
195 | void *user_data, hb_destroy_func_t destroy); |
196 | |
197 | /** |
198 | * hb_font_funcs_set_font_v_extents_func: |
199 | * @ffuncs: font functions. |
200 | * @func: (closure user_data) (destroy destroy) (scope notified): |
201 | * @user_data: |
202 | * @destroy: |
203 | * |
204 | * |
205 | * |
206 | * Since: 1.1.2 |
207 | **/ |
208 | HB_EXTERN void |
209 | hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs, |
210 | hb_font_get_font_v_extents_func_t func, |
211 | void *user_data, hb_destroy_func_t destroy); |
212 | |
213 | /** |
214 | * hb_font_funcs_set_nominal_glyph_func: |
215 | * @ffuncs: font functions. |
216 | * @func: (closure user_data) (destroy destroy) (scope notified): |
217 | * @user_data: |
218 | * @destroy: |
219 | * |
220 | * |
221 | * |
222 | * Since: 1.2.3 |
223 | **/ |
224 | HB_EXTERN void |
225 | hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs, |
226 | hb_font_get_nominal_glyph_func_t func, |
227 | void *user_data, hb_destroy_func_t destroy); |
228 | |
229 | /** |
230 | * hb_font_funcs_set_variation_glyph_func: |
231 | * @ffuncs: font functions. |
232 | * @func: (closure user_data) (destroy destroy) (scope notified): |
233 | * @user_data: |
234 | * @destroy: |
235 | * |
236 | * |
237 | * |
238 | * Since: 1.2.3 |
239 | **/ |
240 | HB_EXTERN void |
241 | hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs, |
242 | hb_font_get_variation_glyph_func_t func, |
243 | void *user_data, hb_destroy_func_t destroy); |
244 | |
245 | /** |
246 | * hb_font_funcs_set_glyph_h_advance_func: |
247 | * @ffuncs: font functions. |
248 | * @func: (closure user_data) (destroy destroy) (scope notified): |
249 | * @user_data: |
250 | * @destroy: |
251 | * |
252 | * |
253 | * |
254 | * Since: 0.9.2 |
255 | **/ |
256 | HB_EXTERN void |
257 | hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs, |
258 | hb_font_get_glyph_h_advance_func_t func, |
259 | void *user_data, hb_destroy_func_t destroy); |
260 | |
261 | /** |
262 | * hb_font_funcs_set_glyph_v_advance_func: |
263 | * @ffuncs: font functions. |
264 | * @func: (closure user_data) (destroy destroy) (scope notified): |
265 | * @user_data: |
266 | * @destroy: |
267 | * |
268 | * |
269 | * |
270 | * Since: 0.9.2 |
271 | **/ |
272 | HB_EXTERN void |
273 | hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs, |
274 | hb_font_get_glyph_v_advance_func_t func, |
275 | void *user_data, hb_destroy_func_t destroy); |
276 | |
277 | /** |
278 | * hb_font_funcs_set_glyph_h_advances_func: |
279 | * @ffuncs: font functions. |
280 | * @func: (closure user_data) (destroy destroy) (scope notified): |
281 | * @user_data: |
282 | * @destroy: |
283 | * |
284 | * |
285 | * |
286 | * Since: 1.8.6 |
287 | **/ |
288 | HB_EXTERN void |
289 | hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs, |
290 | hb_font_get_glyph_h_advances_func_t func, |
291 | void *user_data, hb_destroy_func_t destroy); |
292 | |
293 | /** |
294 | * hb_font_funcs_set_glyph_v_advances_func: |
295 | * @ffuncs: font functions. |
296 | * @func: (closure user_data) (destroy destroy) (scope notified): |
297 | * @user_data: |
298 | * @destroy: |
299 | * |
300 | * |
301 | * |
302 | * Since: 1.8.6 |
303 | **/ |
304 | HB_EXTERN void |
305 | hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs, |
306 | hb_font_get_glyph_v_advances_func_t func, |
307 | void *user_data, hb_destroy_func_t destroy); |
308 | |
309 | /** |
310 | * hb_font_funcs_set_glyph_h_origin_func: |
311 | * @ffuncs: font functions. |
312 | * @func: (closure user_data) (destroy destroy) (scope notified): |
313 | * @user_data: |
314 | * @destroy: |
315 | * |
316 | * |
317 | * |
318 | * Since: 0.9.2 |
319 | **/ |
320 | HB_EXTERN void |
321 | hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs, |
322 | hb_font_get_glyph_h_origin_func_t func, |
323 | void *user_data, hb_destroy_func_t destroy); |
324 | |
325 | /** |
326 | * hb_font_funcs_set_glyph_v_origin_func: |
327 | * @ffuncs: font functions. |
328 | * @func: (closure user_data) (destroy destroy) (scope notified): |
329 | * @user_data: |
330 | * @destroy: |
331 | * |
332 | * |
333 | * |
334 | * Since: 0.9.2 |
335 | **/ |
336 | HB_EXTERN void |
337 | hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs, |
338 | hb_font_get_glyph_v_origin_func_t func, |
339 | void *user_data, hb_destroy_func_t destroy); |
340 | |
341 | /** |
342 | * hb_font_funcs_set_glyph_h_kerning_func: |
343 | * @ffuncs: font functions. |
344 | * @func: (closure user_data) (destroy destroy) (scope notified): |
345 | * @user_data: |
346 | * @destroy: |
347 | * |
348 | * |
349 | * |
350 | * Since: 0.9.2 |
351 | **/ |
352 | HB_EXTERN void |
353 | hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs, |
354 | hb_font_get_glyph_h_kerning_func_t func, |
355 | void *user_data, hb_destroy_func_t destroy); |
356 | |
357 | /** |
358 | * hb_font_funcs_set_glyph_v_kerning_func: |
359 | * @ffuncs: font functions. |
360 | * @func: (closure user_data) (destroy destroy) (scope notified): |
361 | * @user_data: |
362 | * @destroy: |
363 | * |
364 | * |
365 | * |
366 | * Since: 0.9.2 |
367 | **/ |
368 | HB_EXTERN void |
369 | hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs, |
370 | hb_font_get_glyph_v_kerning_func_t func, |
371 | void *user_data, hb_destroy_func_t destroy); |
372 | |
373 | /** |
374 | * hb_font_funcs_set_glyph_extents_func: |
375 | * @ffuncs: font functions. |
376 | * @func: (closure user_data) (destroy destroy) (scope notified): |
377 | * @user_data: |
378 | * @destroy: |
379 | * |
380 | * |
381 | * |
382 | * Since: 0.9.2 |
383 | **/ |
384 | HB_EXTERN void |
385 | hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs, |
386 | hb_font_get_glyph_extents_func_t func, |
387 | void *user_data, hb_destroy_func_t destroy); |
388 | |
389 | /** |
390 | * hb_font_funcs_set_glyph_contour_point_func: |
391 | * @ffuncs: font functions. |
392 | * @func: (closure user_data) (destroy destroy) (scope notified): |
393 | * @user_data: |
394 | * @destroy: |
395 | * |
396 | * |
397 | * |
398 | * Since: 0.9.2 |
399 | **/ |
400 | HB_EXTERN void |
401 | hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs, |
402 | hb_font_get_glyph_contour_point_func_t func, |
403 | void *user_data, hb_destroy_func_t destroy); |
404 | |
405 | /** |
406 | * hb_font_funcs_set_glyph_name_func: |
407 | * @ffuncs: font functions. |
408 | * @func: (closure user_data) (destroy destroy) (scope notified): |
409 | * @user_data: |
410 | * @destroy: |
411 | * |
412 | * |
413 | * |
414 | * Since: 0.9.2 |
415 | **/ |
416 | HB_EXTERN void |
417 | hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs, |
418 | hb_font_get_glyph_name_func_t func, |
419 | void *user_data, hb_destroy_func_t destroy); |
420 | |
421 | /** |
422 | * hb_font_funcs_set_glyph_from_name_func: |
423 | * @ffuncs: font functions. |
424 | * @func: (closure user_data) (destroy destroy) (scope notified): |
425 | * @user_data: |
426 | * @destroy: |
427 | * |
428 | * |
429 | * |
430 | * Since: 0.9.2 |
431 | **/ |
432 | HB_EXTERN void |
433 | hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs, |
434 | hb_font_get_glyph_from_name_func_t func, |
435 | void *user_data, hb_destroy_func_t destroy); |
436 | |
437 | /* func dispatch */ |
438 | |
439 | HB_EXTERN hb_bool_t |
440 | hb_font_get_h_extents (hb_font_t *font, |
441 | hb_font_extents_t *extents); |
442 | HB_EXTERN hb_bool_t |
443 | hb_font_get_v_extents (hb_font_t *font, |
444 | hb_font_extents_t *extents); |
445 | |
446 | HB_EXTERN hb_bool_t |
447 | hb_font_get_nominal_glyph (hb_font_t *font, |
448 | hb_codepoint_t unicode, |
449 | hb_codepoint_t *glyph); |
450 | HB_EXTERN hb_bool_t |
451 | hb_font_get_variation_glyph (hb_font_t *font, |
452 | hb_codepoint_t unicode, hb_codepoint_t variation_selector, |
453 | hb_codepoint_t *glyph); |
454 | |
455 | HB_EXTERN hb_position_t |
456 | hb_font_get_glyph_h_advance (hb_font_t *font, |
457 | hb_codepoint_t glyph); |
458 | HB_EXTERN hb_position_t |
459 | hb_font_get_glyph_v_advance (hb_font_t *font, |
460 | hb_codepoint_t glyph); |
461 | |
462 | HB_EXTERN void |
463 | hb_font_get_glyph_h_advances (hb_font_t* font, |
464 | unsigned count, |
465 | hb_codepoint_t *first_glyph, |
466 | unsigned glyph_stride, |
467 | hb_position_t *first_advance, |
468 | unsigned advance_stride); |
469 | HB_EXTERN void |
470 | hb_font_get_glyph_v_advances (hb_font_t* font, |
471 | unsigned count, |
472 | hb_codepoint_t *first_glyph, |
473 | unsigned glyph_stride, |
474 | hb_position_t *first_advance, |
475 | unsigned advance_stride); |
476 | |
477 | HB_EXTERN hb_bool_t |
478 | hb_font_get_glyph_h_origin (hb_font_t *font, |
479 | hb_codepoint_t glyph, |
480 | hb_position_t *x, hb_position_t *y); |
481 | HB_EXTERN hb_bool_t |
482 | hb_font_get_glyph_v_origin (hb_font_t *font, |
483 | hb_codepoint_t glyph, |
484 | hb_position_t *x, hb_position_t *y); |
485 | |
486 | HB_EXTERN hb_position_t |
487 | hb_font_get_glyph_h_kerning (hb_font_t *font, |
488 | hb_codepoint_t left_glyph, hb_codepoint_t right_glyph); |
489 | HB_EXTERN hb_position_t |
490 | hb_font_get_glyph_v_kerning (hb_font_t *font, |
491 | hb_codepoint_t top_glyph, hb_codepoint_t bottom_glyph); |
492 | |
493 | HB_EXTERN hb_bool_t |
494 | hb_font_get_glyph_extents (hb_font_t *font, |
495 | hb_codepoint_t glyph, |
496 | hb_glyph_extents_t *extents); |
497 | |
498 | HB_EXTERN hb_bool_t |
499 | hb_font_get_glyph_contour_point (hb_font_t *font, |
500 | hb_codepoint_t glyph, unsigned int point_index, |
501 | hb_position_t *x, hb_position_t *y); |
502 | |
503 | HB_EXTERN hb_bool_t |
504 | hb_font_get_glyph_name (hb_font_t *font, |
505 | hb_codepoint_t glyph, |
506 | char *name, unsigned int size); |
507 | HB_EXTERN hb_bool_t |
508 | hb_font_get_glyph_from_name (hb_font_t *font, |
509 | const char *name, int len, /* -1 means nul-terminated */ |
510 | hb_codepoint_t *glyph); |
511 | |
512 | |
513 | /* high-level funcs, with fallback */ |
514 | |
515 | /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0, |
516 | * otherwise calls hb_font_get_variation_glyph(). */ |
517 | HB_EXTERN hb_bool_t |
518 | hb_font_get_glyph (hb_font_t *font, |
519 | hb_codepoint_t unicode, hb_codepoint_t variation_selector, |
520 | hb_codepoint_t *glyph); |
521 | |
522 | HB_EXTERN void |
523 | hb_font_get_extents_for_direction (hb_font_t *font, |
524 | hb_direction_t direction, |
525 | hb_font_extents_t *extents); |
526 | HB_EXTERN void |
527 | hb_font_get_glyph_advance_for_direction (hb_font_t *font, |
528 | hb_codepoint_t glyph, |
529 | hb_direction_t direction, |
530 | hb_position_t *x, hb_position_t *y); |
531 | HB_EXTERN void |
532 | hb_font_get_glyph_advances_for_direction (hb_font_t* font, |
533 | hb_direction_t direction, |
534 | unsigned count, |
535 | hb_codepoint_t *first_glyph, |
536 | unsigned glyph_stride, |
537 | hb_position_t *first_advance, |
538 | unsigned advance_stride); |
539 | HB_EXTERN void |
540 | hb_font_get_glyph_origin_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_add_glyph_origin_for_direction (hb_font_t *font, |
546 | hb_codepoint_t glyph, |
547 | hb_direction_t direction, |
548 | hb_position_t *x, hb_position_t *y); |
549 | HB_EXTERN void |
550 | hb_font_subtract_glyph_origin_for_direction (hb_font_t *font, |
551 | hb_codepoint_t glyph, |
552 | hb_direction_t direction, |
553 | hb_position_t *x, hb_position_t *y); |
554 | |
555 | HB_EXTERN void |
556 | hb_font_get_glyph_kerning_for_direction (hb_font_t *font, |
557 | hb_codepoint_t first_glyph, hb_codepoint_t second_glyph, |
558 | hb_direction_t direction, |
559 | hb_position_t *x, hb_position_t *y); |
560 | |
561 | HB_EXTERN hb_bool_t |
562 | hb_font_get_glyph_extents_for_origin (hb_font_t *font, |
563 | hb_codepoint_t glyph, |
564 | hb_direction_t direction, |
565 | hb_glyph_extents_t *extents); |
566 | |
567 | HB_EXTERN hb_bool_t |
568 | hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, |
569 | hb_codepoint_t glyph, unsigned int point_index, |
570 | hb_direction_t direction, |
571 | hb_position_t *x, hb_position_t *y); |
572 | |
573 | /* Generates gidDDD if glyph has no name. */ |
574 | HB_EXTERN void |
575 | hb_font_glyph_to_string (hb_font_t *font, |
576 | hb_codepoint_t glyph, |
577 | char *s, unsigned int size); |
578 | /* Parses gidDDD and uniUUUU strings automatically. */ |
579 | HB_EXTERN hb_bool_t |
580 | hb_font_glyph_from_string (hb_font_t *font, |
581 | const char *s, int len, /* -1 means nul-terminated */ |
582 | hb_codepoint_t *glyph); |
583 | |
584 | |
585 | /* |
586 | * hb_font_t |
587 | */ |
588 | |
589 | /* Fonts are very light-weight objects */ |
590 | |
591 | HB_EXTERN hb_font_t * |
592 | hb_font_create (hb_face_t *face); |
593 | |
594 | HB_EXTERN hb_font_t * |
595 | hb_font_create_sub_font (hb_font_t *parent); |
596 | |
597 | HB_EXTERN hb_font_t * |
598 | hb_font_get_empty (void); |
599 | |
600 | HB_EXTERN hb_font_t * |
601 | hb_font_reference (hb_font_t *font); |
602 | |
603 | HB_EXTERN void |
604 | hb_font_destroy (hb_font_t *font); |
605 | |
606 | HB_EXTERN hb_bool_t |
607 | hb_font_set_user_data (hb_font_t *font, |
608 | hb_user_data_key_t *key, |
609 | void * data, |
610 | hb_destroy_func_t destroy, |
611 | hb_bool_t replace); |
612 | |
613 | |
614 | HB_EXTERN void * |
615 | hb_font_get_user_data (hb_font_t *font, |
616 | hb_user_data_key_t *key); |
617 | |
618 | HB_EXTERN void |
619 | hb_font_make_immutable (hb_font_t *font); |
620 | |
621 | HB_EXTERN hb_bool_t |
622 | hb_font_is_immutable (hb_font_t *font); |
623 | |
624 | HB_EXTERN void |
625 | hb_font_set_parent (hb_font_t *font, |
626 | hb_font_t *parent); |
627 | |
628 | HB_EXTERN hb_font_t * |
629 | hb_font_get_parent (hb_font_t *font); |
630 | |
631 | HB_EXTERN void |
632 | hb_font_set_face (hb_font_t *font, |
633 | hb_face_t *face); |
634 | |
635 | HB_EXTERN hb_face_t * |
636 | hb_font_get_face (hb_font_t *font); |
637 | |
638 | |
639 | HB_EXTERN void |
640 | hb_font_set_funcs (hb_font_t *font, |
641 | hb_font_funcs_t *klass, |
642 | void *font_data, |
643 | hb_destroy_func_t destroy); |
644 | |
645 | /* Be *very* careful with this function! */ |
646 | HB_EXTERN void |
647 | hb_font_set_funcs_data (hb_font_t *font, |
648 | void *font_data, |
649 | hb_destroy_func_t destroy); |
650 | |
651 | |
652 | HB_EXTERN void |
653 | hb_font_set_scale (hb_font_t *font, |
654 | int x_scale, |
655 | int y_scale); |
656 | |
657 | HB_EXTERN void |
658 | hb_font_get_scale (hb_font_t *font, |
659 | int *x_scale, |
660 | int *y_scale); |
661 | |
662 | /* |
663 | * A zero value means "no hinting in that direction" |
664 | */ |
665 | HB_EXTERN void |
666 | hb_font_set_ppem (hb_font_t *font, |
667 | unsigned int x_ppem, |
668 | unsigned int y_ppem); |
669 | |
670 | HB_EXTERN void |
671 | hb_font_get_ppem (hb_font_t *font, |
672 | unsigned int *x_ppem, |
673 | unsigned int *y_ppem); |
674 | |
675 | /* |
676 | * Point size per EM. Used for optical-sizing in CoreText. |
677 | * A value of zero means "not set". |
678 | */ |
679 | HB_EXTERN void |
680 | hb_font_set_ptem (hb_font_t *font, float ptem); |
681 | |
682 | HB_EXTERN float |
683 | hb_font_get_ptem (hb_font_t *font); |
684 | |
685 | HB_EXTERN void |
686 | hb_font_set_variations (hb_font_t *font, |
687 | const hb_variation_t *variations, |
688 | unsigned int variations_length); |
689 | |
690 | HB_EXTERN void |
691 | hb_font_set_var_coords_design (hb_font_t *font, |
692 | const float *coords, |
693 | unsigned int coords_length); |
694 | |
695 | HB_EXTERN void |
696 | hb_font_set_var_coords_normalized (hb_font_t *font, |
697 | const int *coords, /* 2.14 normalized */ |
698 | unsigned int coords_length); |
699 | |
700 | HB_EXTERN const int * |
701 | hb_font_get_var_coords_normalized (hb_font_t *font, |
702 | unsigned int *length); |
703 | |
704 | HB_END_DECLS |
705 | |
706 | #endif /* HB_FONT_H */ |
707 | |