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_FACE_H |
32 | #define HB_FACE_H |
33 | |
34 | #include "hb-common.h" |
35 | #include "hb-blob.h" |
36 | #include "hb-set.h" |
37 | |
38 | HB_BEGIN_DECLS |
39 | |
40 | |
41 | HB_EXTERN unsigned int |
42 | hb_face_count (hb_blob_t *blob); |
43 | |
44 | |
45 | /* |
46 | * hb_face_t |
47 | */ |
48 | |
49 | /** |
50 | * hb_face_t: |
51 | * |
52 | * Data type for holding font faces. |
53 | * |
54 | **/ |
55 | typedef struct hb_face_t hb_face_t; |
56 | |
57 | HB_EXTERN hb_face_t * |
58 | hb_face_create (hb_blob_t *blob, |
59 | unsigned int index); |
60 | |
61 | typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag, void *user_data); |
62 | |
63 | /* calls destroy() when not needing user_data anymore */ |
64 | HB_EXTERN hb_face_t * |
65 | hb_face_create_for_tables (hb_reference_table_func_t reference_table_func, |
66 | void *user_data, |
67 | hb_destroy_func_t destroy); |
68 | |
69 | HB_EXTERN hb_face_t * |
70 | hb_face_get_empty (void); |
71 | |
72 | HB_EXTERN hb_face_t * |
73 | hb_face_reference (hb_face_t *face); |
74 | |
75 | HB_EXTERN void |
76 | hb_face_destroy (hb_face_t *face); |
77 | |
78 | HB_EXTERN hb_bool_t |
79 | hb_face_set_user_data (hb_face_t *face, |
80 | hb_user_data_key_t *key, |
81 | void * data, |
82 | hb_destroy_func_t destroy, |
83 | hb_bool_t replace); |
84 | |
85 | HB_EXTERN void * |
86 | hb_face_get_user_data (const hb_face_t *face, |
87 | hb_user_data_key_t *key); |
88 | |
89 | HB_EXTERN void |
90 | hb_face_make_immutable (hb_face_t *face); |
91 | |
92 | HB_EXTERN hb_bool_t |
93 | hb_face_is_immutable (const hb_face_t *face); |
94 | |
95 | |
96 | HB_EXTERN hb_blob_t * |
97 | hb_face_reference_table (const hb_face_t *face, |
98 | hb_tag_t tag); |
99 | |
100 | HB_EXTERN hb_blob_t * |
101 | hb_face_reference_blob (hb_face_t *face); |
102 | |
103 | HB_EXTERN void |
104 | hb_face_set_index (hb_face_t *face, |
105 | unsigned int index); |
106 | |
107 | HB_EXTERN unsigned int |
108 | hb_face_get_index (const hb_face_t *face); |
109 | |
110 | HB_EXTERN void |
111 | hb_face_set_upem (hb_face_t *face, |
112 | unsigned int upem); |
113 | |
114 | HB_EXTERN unsigned int |
115 | hb_face_get_upem (const hb_face_t *face); |
116 | |
117 | HB_EXTERN void |
118 | hb_face_set_glyph_count (hb_face_t *face, |
119 | unsigned int glyph_count); |
120 | |
121 | HB_EXTERN unsigned int |
122 | hb_face_get_glyph_count (const hb_face_t *face); |
123 | |
124 | HB_EXTERN unsigned int |
125 | hb_face_get_table_tags (const hb_face_t *face, |
126 | unsigned int start_offset, |
127 | unsigned int *table_count, /* IN/OUT */ |
128 | hb_tag_t *table_tags /* OUT */); |
129 | |
130 | |
131 | /* |
132 | * Character set. |
133 | */ |
134 | |
135 | HB_EXTERN void |
136 | hb_face_collect_unicodes (hb_face_t *face, |
137 | hb_set_t *out); |
138 | |
139 | HB_EXTERN void |
140 | hb_face_collect_variation_selectors (hb_face_t *face, |
141 | hb_set_t *out); |
142 | |
143 | HB_EXTERN void |
144 | hb_face_collect_variation_unicodes (hb_face_t *face, |
145 | hb_codepoint_t variation_selector, |
146 | hb_set_t *out); |
147 | |
148 | |
149 | /* |
150 | * Builder face. |
151 | */ |
152 | |
153 | HB_EXTERN hb_face_t * |
154 | hb_face_builder_create (void); |
155 | |
156 | HB_EXTERN hb_bool_t |
157 | hb_face_builder_add_table (hb_face_t *face, |
158 | hb_tag_t tag, |
159 | hb_blob_t *blob); |
160 | |
161 | |
162 | HB_END_DECLS |
163 | |
164 | #endif /* HB_FACE_H */ |
165 | |