Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Side by Side Diff: third_party/harfbuzz-ng/src/hb-font.h

Issue 9223010: Update harfbuzz-ng to 1a5a91dc0d8bf4b72a2f22dc6300b06ad7000b79. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't use -M option for 'git diff' to patch correctly Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Red Hat, Inc. 2 * Copyright © 2009 Red Hat, Inc.
3 * 3 *
4 * This is part of HarfBuzz, a text shaping library. 4 * This is part of HarfBuzz, a text shaping library.
5 * 5 *
6 * Permission is hereby granted, without written agreement and without 6 * Permission is hereby granted, without written agreement and without
7 * license or royalty fees, to use, copy, modify, and distribute this 7 * license or royalty fees, to use, copy, modify, and distribute this
8 * software and its documentation for any purpose, provided that the 8 * software and its documentation for any purpose, provided that the
9 * above copyright notice and the following two paragraphs appear in 9 * above copyright notice and the following two paragraphs appear in
10 * all copies of this software. 10 * all copies of this software.
11 * 11 *
12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
(...skipping 21 matching lines...) Expand all
34 34
35 35
36 typedef struct _hb_face_t hb_face_t; 36 typedef struct _hb_face_t hb_face_t;
37 typedef struct _hb_font_t hb_font_t; 37 typedef struct _hb_font_t hb_font_t;
38 38
39 /* 39 /*
40 * hb_face_t 40 * hb_face_t
41 */ 41 */
42 42
43 hb_face_t * 43 hb_face_t *
44 hb_face_create_for_data (hb_blob_t *blob, 44 hb_face_create (hb_blob_t *blob,
45 » » » unsigned int index); 45 » » unsigned int index);
46 46
47 typedef hb_blob_t * (*hb_get_table_func_t) (hb_tag_t tag, void *user_data); 47 typedef hb_blob_t * (*hb_reference_table_func_t) (hb_face_t *face, hb_tag_t tag , void *user_data);
48 48
49 /* calls destroy() when not needing user_data anymore */ 49 /* calls destroy() when not needing user_data anymore */
50 hb_face_t * 50 hb_face_t *
51 hb_face_create_for_tables (hb_get_table_func_t get_table, 51 hb_face_create_for_tables (hb_reference_table_func_t reference_table,
52 » » » hb_destroy_func_t destroy, 52 » » » void *user_data,
53 » » » void *user_data); 53 » » » hb_destroy_func_t destroy);
54
55 hb_face_t *
56 hb_face_get_empty (void);
54 57
55 hb_face_t * 58 hb_face_t *
56 hb_face_reference (hb_face_t *face); 59 hb_face_reference (hb_face_t *face);
57 60
58 unsigned int
59 hb_face_get_reference_count (hb_face_t *face);
60
61 void 61 void
62 hb_face_destroy (hb_face_t *face); 62 hb_face_destroy (hb_face_t *face);
63 63
64 /* XXX 64 hb_bool_t
65 * 65 hb_face_set_user_data (hb_face_t *face,
66 * I have two major concerns about this API as it is right now: 66 » » hb_user_data_key_t *key,
67 * 67 » » void * data,
68 * - Jonathan Kew convinced me to make it return NULL if table not found (280a f1bd), 68 » » hb_destroy_func_t destroy,
69 * however, that is WRONG IMO. The API should not differentiate between a n on-existing 69 » » hb_bool_t replace);
70 * table vs a zero-length table vs a very short table. It only leads to imp lementations 70
71 * that check for non-NULL and assume that they've got a usable table going on... This 71
72 * actually happened with Firefox. 72 void *
73 * 73 hb_face_get_user_data (hb_face_t *face,
74 * - It has to be renamed to reference_table() since unlike any other _get_ AP I, a reference 74 » » hb_user_data_key_t *key);
75 * ownership transfer happens and the user is responsible to destroy the res ult. 75
76 */ 76 void
77 hb_face_make_immutable (hb_face_t *face);
78
79 hb_bool_t
80 hb_face_is_immutable (hb_face_t *face);
81
82
77 hb_blob_t * 83 hb_blob_t *
78 hb_face_get_table (hb_face_t *face, 84 hb_face_reference_table (hb_face_t *face,
79 » » hb_tag_t tag); 85 » » » hb_tag_t tag);
86
87 hb_blob_t *
88 hb_face_reference_blob (hb_face_t *face);
89
90 void
91 hb_face_set_index (hb_face_t *face,
92 » » unsigned int index);
93
94 unsigned int
95 hb_face_get_index (hb_face_t *face);
96
97 void
98 hb_face_set_upem (hb_face_t *face,
99 » » unsigned int upem);
80 100
81 unsigned int 101 unsigned int
82 hb_face_get_upem (hb_face_t *face); 102 hb_face_get_upem (hb_face_t *face);
83 103
84 104
85 /* 105 /*
86 * hb_font_funcs_t 106 * hb_font_funcs_t
87 */ 107 */
88 108
89 typedef struct _hb_font_funcs_t hb_font_funcs_t; 109 typedef struct _hb_font_funcs_t hb_font_funcs_t;
90 110
91 hb_font_funcs_t * 111 hb_font_funcs_t *
92 hb_font_funcs_create (void); 112 hb_font_funcs_create (void);
93 113
94 hb_font_funcs_t * 114 hb_font_funcs_t *
115 hb_font_funcs_get_empty (void);
116
117 hb_font_funcs_t *
95 hb_font_funcs_reference (hb_font_funcs_t *ffuncs); 118 hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
96 119
97 unsigned int
98 hb_font_funcs_get_reference_count (hb_font_funcs_t *ffuncs);
99
100 void 120 void
101 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs); 121 hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
102 122
103 hb_font_funcs_t * 123 hb_bool_t
104 hb_font_funcs_copy (hb_font_funcs_t *ffuncs); 124 hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
125 » » » hb_user_data_key_t *key,
126 » » » void * data,
127 » » » hb_destroy_func_t destroy,
128 » » » hb_bool_t replace);
129
130
131 void *
132 hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
133 » » » hb_user_data_key_t *key);
134
105 135
106 void 136 void
107 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs); 137 hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
108 138
109 hb_bool_t 139 hb_bool_t
110 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs); 140 hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
111 141
112 /* funcs */ 142 /* funcs */
113 143
114 typedef struct _hb_glyph_extents_t 144 typedef struct _hb_glyph_extents_t
115 { 145 {
116 hb_position_t x_bearing; 146 hb_position_t x_bearing;
117 hb_position_t y_bearing; 147 hb_position_t y_bearing;
118 hb_position_t width; 148 hb_position_t width;
119 hb_position_t height; 149 hb_position_t height;
120 } hb_glyph_extents_t; 150 } hb_glyph_extents_t;
121 151
122 typedef hb_codepoint_t (*hb_font_get_glyph_func_t) (hb_font_t *font, hb_face_t * face, const void *user_data,
123 hb_codepoint_t unicode, hb_c odepoint_t variation_selector);
124 typedef void (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, hb_face_t *fa ce, const void *user_data,
125 hb_codepoint_t glyph,
126 hb_position_t *x_advance, hb_p osition_t *y_advance);
127 typedef void (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, hb_face_t *fa ce, const void *user_data,
128 hb_codepoint_t glyph,
129 hb_glyph_extents_t *extents);
130 typedef hb_bool_t (*hb_font_get_contour_point_func_t) (hb_font_t *font, hb_face_ t *face, const void *user_data,
131 unsigned int point_index, hb_codepoint_t glyph,
132 hb_position_t *x, hb_posi tion_t *y);
133 typedef hb_position_t (*hb_font_get_kerning_func_t) (hb_font_t *font, hb_face_t *face, const void *user_data,
134 hb_codepoint_t first_glyph, hb_codepoint_t second_glyph);
135 152
153 /* func types */
154
155 typedef hb_bool_t (*hb_font_get_glyph_func_t) (hb_font_t *font, void *font_data,
156 hb_codepoint_t unicode, hb_codepo int_t variation_selector,
157 hb_codepoint_t *glyph,
158 void *user_data);
159
160
161 typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
162 hb_codepoint_t glyph,
163 void *user_data);
164 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
165 typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
166
167 typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *fon t_data,
168 hb_codepoint_t glyph,
169 hb_position_t *x, hb_posit ion_t *y,
170 void *user_data);
171 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
172 typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
173
174 typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
175 hb_codepoint_t first_ glyph, hb_codepoint_t second_glyph,
176 void *user_data);
177 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
178 typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_v_kerning_func_t;
179
180
181 typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *fo nt_data,
182 hb_codepoint_t glyph,
183 hb_glyph_extents_t *exten ts,
184 void *user_data);
185 typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, vo id *font_data,
186 hb_codepoint_t glyp h, unsigned int point_index,
187 hb_position_t *x, h b_position_t *y,
188 void *user_data);
189
190
191 /* func setters */
136 192
137 void 193 void
138 hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs, 194 hb_font_funcs_set_glyph_func (hb_font_funcs_t *ffuncs,
139 » » » hb_font_get_glyph_func_t glyph_func); 195 » » » hb_font_get_glyph_func_t glyph_func,
196 » » » void *user_data, hb_destroy_func_t destroy);
140 197
141 void 198 void
142 hb_font_funcs_set_glyph_advance_func (hb_font_funcs_t *ffuncs, 199 hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
143 » » » » hb_font_get_glyph_advance_func_t glyph_adv ance_func); 200 » » » » » hb_font_get_glyph_h_advance_func_t func,
201 » » » » » void *user_data, hb_destroy_func_t destr oy);
202 void
203 hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
204 » » » » » hb_font_get_glyph_v_advance_func_t func,
205 » » » » » void *user_data, hb_destroy_func_t destr oy);
206
207 void
208 hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
209 » » » » hb_font_get_glyph_h_origin_func_t func,
210 » » » » void *user_data, hb_destroy_func_t destro y);
211 void
212 hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
213 » » » » hb_font_get_glyph_v_origin_func_t func,
214 » » » » void *user_data, hb_destroy_func_t destro y);
215
216 void
217 hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
218 » » » » » hb_font_get_glyph_h_kerning_func_t func,
219 » » » » » void *user_data, hb_destroy_func_t destr oy);
220 void
221 hb_font_funcs_set_glyph_v_kerning_func (hb_font_funcs_t *ffuncs,
222 » » » » » hb_font_get_glyph_v_kerning_func_t func,
223 » » » » » void *user_data, hb_destroy_func_t destr oy);
144 224
145 void 225 void
146 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs, 226 hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
147 » » » » hb_font_get_glyph_extents_func_t glyph_ext ents_func); 227 » » » » hb_font_get_glyph_extents_func_t func,
148 228 » » » » void *user_data, hb_destroy_func_t destroy );
149 void 229 void
150 hb_font_funcs_set_contour_point_func (hb_font_funcs_t *ffuncs, 230 hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
151 » » » » hb_font_get_contour_point_func_t contour_p oint_func); 231 » » » » » hb_font_get_glyph_contour_point_func _t func,
152 232 » » » » » void *user_data, hb_destroy_func_t d estroy);
153 void
154 hb_font_funcs_set_kerning_func (hb_font_funcs_t *ffuncs,
155 » » » » hb_font_get_kerning_func_t kerning_func);
156 233
157 234
158 /* These never return NULL. Return fallback defaults instead. */ 235 /* func dispatch */
159 236
160 hb_font_get_glyph_func_t 237 hb_bool_t
161 hb_font_funcs_get_glyph_func (hb_font_funcs_t *ffuncs); 238 hb_font_get_glyph (hb_font_t *font,
239 » » hb_codepoint_t unicode, hb_codepoint_t variation_selector,
240 » » hb_codepoint_t *glyph);
162 241
163 hb_font_get_glyph_advance_func_t 242 hb_position_t
164 hb_font_funcs_get_glyph_advance_func (hb_font_funcs_t *ffuncs); 243 hb_font_get_glyph_h_advance (hb_font_t *font,
244 » » » hb_codepoint_t glyph);
245 hb_position_t
246 hb_font_get_glyph_v_advance (hb_font_t *font,
247 » » » hb_codepoint_t glyph);
165 248
166 hb_font_get_glyph_extents_func_t 249 hb_bool_t
167 hb_font_funcs_get_glyph_extents_func (hb_font_funcs_t *ffuncs); 250 hb_font_get_glyph_h_origin (hb_font_t *font,
251 » » » hb_codepoint_t glyph,
252 » » » hb_position_t *x, hb_position_t *y);
253 hb_bool_t
254 hb_font_get_glyph_v_origin (hb_font_t *font,
255 » » » hb_codepoint_t glyph,
256 » » » hb_position_t *x, hb_position_t *y);
168 257
169 hb_font_get_contour_point_func_t 258 hb_position_t
170 hb_font_funcs_get_contour_point_func (hb_font_funcs_t *ffuncs); 259 hb_font_get_glyph_h_kerning (hb_font_t *font,
260 » » » hb_codepoint_t left_glyph, hb_codepoint_t right_gly ph);
261 hb_position_t
262 hb_font_get_glyph_v_kerning (hb_font_t *font,
263 » » » hb_codepoint_t top_glyph, hb_codepoint_t bottom_gly ph);
171 264
172 hb_font_get_kerning_func_t 265 hb_bool_t
173 hb_font_funcs_get_kerning_func (hb_font_funcs_t *ffuncs); 266 hb_font_get_glyph_extents (hb_font_t *font,
174
175
176 hb_codepoint_t
177 hb_font_get_glyph (hb_font_t *font, hb_face_t *face,
178 » » hb_codepoint_t unicode, hb_codepoint_t variation_selector);
179
180 void
181 hb_font_get_glyph_advance (hb_font_t *font, hb_face_t *face,
182 » » » hb_codepoint_t glyph,
183 » » » hb_position_t *x_advance, hb_position_t *y_advance);
184
185 void
186 hb_font_get_glyph_extents (hb_font_t *font, hb_face_t *face,
187 hb_codepoint_t glyph, 267 hb_codepoint_t glyph,
188 hb_glyph_extents_t *extents); 268 hb_glyph_extents_t *extents);
189 269
190 hb_bool_t 270 hb_bool_t
191 hb_font_get_contour_point (hb_font_t *font, hb_face_t *face, 271 hb_font_get_glyph_contour_point (hb_font_t *font,
192 » » » unsigned int point_index, hb_codepoint_t glyph, 272 » » » » hb_codepoint_t glyph, unsigned int point_index,
193 » » » hb_position_t *x, hb_position_t *y); 273 » » » » hb_position_t *x, hb_position_t *y);
194 274
195 hb_position_t 275
196 hb_font_get_kerning (hb_font_t *font, hb_face_t *face, 276 /* high-level funcs, with fallback */
197 » » hb_codepoint_t first_glyph, hb_codepoint_t second_glyph); 277
278 void
279 hb_font_get_glyph_advance_for_direction (hb_font_t *font,
280 » » » » » hb_codepoint_t glyph,
281 » » » » » hb_direction_t direction,
282 » » » » » hb_position_t *x, hb_position_t *y);
283 void
284 hb_font_get_glyph_origin_for_direction (hb_font_t *font,
285 » » » » » hb_codepoint_t glyph,
286 » » » » » hb_direction_t direction,
287 » » » » » hb_position_t *x, hb_position_t *y);
288 void
289 hb_font_add_glyph_origin_for_direction (hb_font_t *font,
290 » » » » » hb_codepoint_t glyph,
291 » » » » » hb_direction_t direction,
292 » » » » » hb_position_t *x, hb_position_t *y);
293 void
294 hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
295 » » » » » hb_codepoint_t glyph,
296 » » » » » hb_direction_t direction,
297 » » » » » hb_position_t *x, hb_position_t *y) ;
298
299 void
300 hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
301 » » » » » hb_codepoint_t first_glyph, hb_codepoin t_t second_glyph,
302 » » » » » hb_direction_t direction,
303 » » » » » hb_position_t *x, hb_position_t *y);
304
305 hb_bool_t
306 hb_font_get_glyph_extents_for_origin (hb_font_t *font,
307 » » » » hb_codepoint_t glyph,
308 » » » » hb_direction_t direction,
309 » » » » hb_glyph_extents_t *extents);
310
311 hb_bool_t
312 hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
313 » » » » » hb_codepoint_t glyph, unsigned int p oint_index,
314 » » » » » hb_direction_t direction,
315 » » » » » hb_position_t *x, hb_position_t *y);
198 316
199 317
200 /* 318 /*
201 * hb_font_t 319 * hb_font_t
202 */ 320 */
203 321
204 /* Fonts are very light-weight objects */ 322 /* Fonts are very light-weight objects */
205 323
206 hb_font_t * 324 hb_font_t *
207 hb_font_create (void); 325 hb_font_create (hb_face_t *face);
326
327 hb_font_t *
328 hb_font_create_sub_font (hb_font_t *parent);
329
330 hb_font_t *
331 hb_font_get_empty (void);
208 332
209 hb_font_t * 333 hb_font_t *
210 hb_font_reference (hb_font_t *font); 334 hb_font_reference (hb_font_t *font);
211 335
212 unsigned int 336 void
213 hb_font_get_reference_count (hb_font_t *font); 337 hb_font_destroy (hb_font_t *font);
338
339 hb_bool_t
340 hb_font_set_user_data (hb_font_t *font,
341 » » hb_user_data_key_t *key,
342 » » void * data,
343 » » hb_destroy_func_t destroy,
344 » » hb_bool_t replace);
345
346
347 void *
348 hb_font_get_user_data (hb_font_t *font,
349 » » hb_user_data_key_t *key);
214 350
215 void 351 void
216 hb_font_destroy (hb_font_t *font); 352 hb_font_make_immutable (hb_font_t *font);
353
354 hb_bool_t
355 hb_font_is_immutable (hb_font_t *font);
356
357 hb_font_t *
358 hb_font_get_parent (hb_font_t *font);
359
360 hb_face_t *
361 hb_font_get_face (hb_font_t *font);
362
217 363
218 void 364 void
219 hb_font_set_funcs (hb_font_t *font, 365 hb_font_set_funcs (hb_font_t *font,
220 hb_font_funcs_t *klass, 366 hb_font_funcs_t *klass,
221 » » hb_destroy_func_t destroy, 367 » » void *font_data,
222 » » void *user_data); 368 » » hb_destroy_func_t destroy);
223 369
224 /* Returns what was set and unsets it, but doesn't destroy(user_data). 370 /* Be *very* careful with this function! */
225 * This is useful for wrapping / chaining font_funcs_t's.
226 *
227 * The client is responsible for:
228 *
229 * - Take ownership of the reference on the returned klass,
230 *
231 * - Calling "destroy(user_data)" exactly once if returned destroy func
232 * is not NULL and the returned info is not needed anymore.
233 */
234 void 371 void
235 hb_font_unset_funcs (hb_font_t *font, 372 hb_font_set_funcs_data (hb_font_t *font,
236 » » hb_font_funcs_t **klass, 373 » » void *font_data,
237 » » hb_destroy_func_t *destroy, 374 » » hb_destroy_func_t destroy);
238 » » void **user_data);
239 375
240 376
241 /*
242 * We should add support for full matrices.
243 */
244 void 377 void
245 hb_font_set_scale (hb_font_t *font, 378 hb_font_set_scale (hb_font_t *font,
246 » » unsigned int x_scale, 379 » » int x_scale,
247 » » unsigned int y_scale); 380 » » int y_scale);
248 381
249 void 382 void
250 hb_font_get_scale (hb_font_t *font, 383 hb_font_get_scale (hb_font_t *font,
251 » » unsigned int *x_scale, 384 » » int *x_scale,
252 » » unsigned int *y_scale); 385 » » int *y_scale);
253 386
254 /* 387 /*
255 * A zero value means "no hinting in that direction" 388 * A zero value means "no hinting in that direction"
256 */ 389 */
257 void 390 void
258 hb_font_set_ppem (hb_font_t *font, 391 hb_font_set_ppem (hb_font_t *font,
259 unsigned int x_ppem, 392 unsigned int x_ppem,
260 unsigned int y_ppem); 393 unsigned int y_ppem);
261 394
262 void 395 void
263 hb_font_get_ppem (hb_font_t *font, 396 hb_font_get_ppem (hb_font_t *font,
264 unsigned int *x_ppem, 397 unsigned int *x_ppem,
265 unsigned int *y_ppem); 398 unsigned int *y_ppem);
266 399
267 400
268 HB_END_DECLS 401 HB_END_DECLS
269 402
270 #endif /* HB_FONT_H */ 403 #endif /* HB_FONT_H */
OLDNEW
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-fallback-shape-private.hh ('k') | third_party/harfbuzz-ng/src/hb-font.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698