OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftdriver.h */ | 3 /* ftdriver.h */ |
4 /* */ | 4 /* */ |
5 /* FreeType font driver interface (specification). */ | 5 /* FreeType font driver interface (specification). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2001, 2002, 2003, 2006, 2008 by */ | 7 /* Copyright 1996-2003, 2006, 2008, 2011 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
9 /* */ | 9 /* */ |
10 /* This file is part of the FreeType project, and may only be used, */ | 10 /* This file is part of the FreeType project, and may only be used, */ |
11 /* modified, and distributed under the terms of the FreeType project */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
15 /* */ | 15 /* */ |
16 /***************************************************************************/ | 16 /***************************************************************************/ |
17 | 17 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 /* additional data for a face from another */ | 155 /* additional data for a face from another */ |
156 /* file/stream. For example, this can be used to */ | 156 /* file/stream. For example, this can be used to */ |
157 /* add data from AFM or PFM files on a Type 1 */ | 157 /* add data from AFM or PFM files on a Type 1 */ |
158 /* face, or a CIDMap on a CID-keyed face. */ | 158 /* face, or a CIDMap on a CID-keyed face. */ |
159 /* */ | 159 /* */ |
160 /* get_advances :: A function handle used to return advance */ | 160 /* get_advances :: A function handle used to return advance */ |
161 /* widths of `count' glyphs (in font units), */ | 161 /* widths of `count' glyphs (in font units), */ |
162 /* starting at `first'. The `vertical' flag must */ | 162 /* starting at `first'. The `vertical' flag must */ |
163 /* be set to get vertical advance heights. The */ | 163 /* be set to get vertical advance heights. The */ |
164 /* `advances' buffer is caller-allocated. */ | 164 /* `advances' buffer is caller-allocated. */ |
165 /* Currently not implemented. The idea of this */ | 165 /* The idea of this function is to be able to */ |
166 /* function is to be able to perform */ | 166 /* perform device-independent text layout without */ |
167 /* device-independent text layout without loading */ | 167 /* loading a single glyph image. */ |
168 /* a single glyph image. */ | |
169 /* */ | 168 /* */ |
170 /* request_size :: A handle to a function used to request the new */ | 169 /* request_size :: A handle to a function used to request the new */ |
171 /* character size. Can be set to 0 if the */ | 170 /* character size. Can be set to 0 if the */ |
172 /* scaling done in the base layer suffices. */ | 171 /* scaling done in the base layer suffices. */ |
173 /* */ | 172 /* */ |
174 /* select_size :: A handle to a function used to select a new */ | 173 /* select_size :: A handle to a function used to select a new */ |
175 /* fixed size. It is used only if */ | 174 /* fixed size. It is used only if */ |
176 /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ | 175 /* @FT_FACE_FLAG_FIXED_SIZES is set. Can be set */ |
177 /* to 0 if the scaling done in the base layer */ | 176 /* to 0 if the scaling done in the base layer */ |
178 /* suffices. */ | 177 /* suffices. */ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 /* to be called to release that allocation. */ | 260 /* to be called to release that allocation. */ |
262 /* fcinit.c (ft_create_default_module_classes) already contains */ | 261 /* fcinit.c (ft_create_default_module_classes) already contains */ |
263 /* a mechanism to call these functions for the default modules */ | 262 /* a mechanism to call these functions for the default modules */ |
264 /* described in ftmodule.h */ | 263 /* described in ftmodule.h */ |
265 /* */ | 264 /* */ |
266 /* Notice that the created Create and Destroy functions call */ | 265 /* Notice that the created Create and Destroy functions call */ |
267 /* pic_init and pic_free function to allow you to manually allocate */ | 266 /* pic_init and pic_free function to allow you to manually allocate */ |
268 /* and initialize any additional global data, like module specific */ | 267 /* and initialize any additional global data, like module specific */ |
269 /* interface, and put them in the global pic container defined in */ | 268 /* interface, and put them in the global pic container defined in */ |
270 /* ftpic.h. if you don't need them just implement the functions as */ | 269 /* ftpic.h. if you don't need them just implement the functions as */ |
271 /* empty to resolve the link error. */ | 270 /* empty to resolve the link error. Also the pic_init and pic_free */ |
| 271 /* functions should be declared in pic.h, to be referred by driver */ |
| 272 /* definition calling FT_DEFINE_DRIVER() in following. */ |
272 /* */ | 273 /* */ |
273 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ | 274 /* When FT_CONFIG_OPTION_PIC is not defined the struct will be */ |
274 /* allocated in the global scope (or the scope where the macro */ | 275 /* allocated in the global scope (or the scope where the macro */ |
275 /* is used). */ | 276 /* is used). */ |
276 /* */ | 277 /* */ |
277 #ifndef FT_CONFIG_OPTION_PIC | 278 #ifndef FT_CONFIG_OPTION_PIC |
278 | 279 |
279 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS | 280 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
280 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ | 281 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ |
281 a_, b_, | 282 a_, b_, |
282 #else | 283 #else |
283 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) | 284 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) |
284 #endif | 285 #endif |
285 | 286 |
286 #define FT_DECLARE_DRIVER(class_) \ | 287 #define FT_DECLARE_DRIVER(class_) \ |
287 FT_CALLBACK_TABLE \ | 288 FT_CALLBACK_TABLE \ |
288 const FT_Driver_ClassRec class_; | 289 const FT_Driver_ClassRec class_; |
289 | 290 |
290 #define FT_DEFINE_DRIVER(class_, \ | 291 #define FT_DEFINE_DRIVER(class_, \ |
291 flags_, size_, name_, version_, requires_, \ | 292 flags_, size_, name_, version_, requires_, \ |
292 interface_, init_, done_, get_interface_, \ | 293 interface_, init_, done_, get_interface_, \ |
293 face_object_size_, size_object_size_, \ | 294 face_object_size_, size_object_size_, \ |
294 slot_object_size_, init_face_, done_face_, \ | 295 slot_object_size_, init_face_, done_face_, \ |
295 init_size_, done_size_, init_slot_, done_slot_, \ | 296 init_size_, done_size_, init_slot_, done_slot_, \ |
296 old_set_char_sizes_, old_set_pixel_sizes_, \ | 297 old_set_char_sizes_, old_set_pixel_sizes_, \ |
297 load_glyph_, get_kerning_, attach_file_, \ | 298 load_glyph_, get_kerning_, attach_file_, \ |
298 get_advances_, request_size_, select_size_ ) \ | 299 get_advances_, request_size_, select_size_ ) \ |
(...skipping 21 matching lines...) Expand all Loading... |
320 load_glyph_, \ | 321 load_glyph_, \ |
321 \ | 322 \ |
322 get_kerning_, \ | 323 get_kerning_, \ |
323 attach_file_, \ | 324 attach_file_, \ |
324 get_advances_, \ | 325 get_advances_, \ |
325 \ | 326 \ |
326 request_size_, \ | 327 request_size_, \ |
327 select_size_ \ | 328 select_size_ \ |
328 }; | 329 }; |
329 | 330 |
330 #else /* FT_CONFIG_OPTION_PIC */ | 331 #else /* FT_CONFIG_OPTION_PIC */ |
331 | 332 |
332 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS | 333 #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
333 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ | 334 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) \ |
334 clazz->set_char_sizes = a_; \ | 335 clazz->set_char_sizes = a_; \ |
335 clazz->set_pixel_sizes = b_; | 336 clazz->set_pixel_sizes = b_; |
336 #else | 337 #else |
337 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) | 338 #define FT_DEFINE_DRIVERS_OLD_INTERNALS(a_,b_) |
338 #endif | 339 #endif |
339 | 340 |
340 #define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_) | 341 #define FT_DECLARE_DRIVER(class_) FT_DECLARE_MODULE(class_) |
341 | 342 |
342 #define FT_DEFINE_DRIVER(class_, \ | 343 #define FT_DEFINE_DRIVER(class_, \ |
343 flags_, size_, name_, version_, requires_, \ | 344 flags_, size_, name_, version_, requires_, \ |
344 interface_, init_, done_, get_interface_, \ | 345 interface_, init_, done_, get_interface_, \ |
345 face_object_size_, size_object_size_, \ | 346 face_object_size_, size_object_size_, \ |
346 slot_object_size_, init_face_, done_face_, \ | 347 slot_object_size_, init_face_, done_face_, \ |
347 init_size_, done_size_, init_slot_, done_slot_, \ | 348 init_size_, done_size_, init_slot_, done_slot_, \ |
348 old_set_char_sizes_, old_set_pixel_sizes_, \ | 349 old_set_char_sizes_, old_set_pixel_sizes_, \ |
349 load_glyph_, get_kerning_, attach_file_, \ | 350 load_glyph_, get_kerning_, attach_file_, \ |
350 get_advances_, request_size_, select_size_ ) \ | 351 get_advances_, request_size_, select_size_ ) \ |
351 void class_##_pic_free( FT_Library library ); \ | |
352 FT_Error class_##_pic_init( FT_Library library ); \ | |
353 \ | 352 \ |
354 void \ | 353 void \ |
355 FT_Destroy_Class_##class_( FT_Library library, \ | 354 FT_Destroy_Class_##class_( FT_Library library, \ |
356 FT_Module_Class* clazz ) \ | 355 FT_Module_Class* clazz ) \ |
357 { \ | 356 { \ |
358 FT_Memory memory = library->memory; \ | 357 FT_Memory memory = library->memory; \ |
359 FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ | 358 FT_Driver_Class dclazz = (FT_Driver_Class)clazz; \ |
360 class_##_pic_free( library ); \ | 359 class_##_pic_free( library ); \ |
361 if ( dclazz ) \ | 360 if ( dclazz ) \ |
362 FT_FREE( dclazz ); \ | 361 FT_FREE( dclazz ); \ |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 \ | 401 \ |
403 clazz->get_kerning = get_kerning_; \ | 402 clazz->get_kerning = get_kerning_; \ |
404 clazz->attach_file = attach_file_; \ | 403 clazz->attach_file = attach_file_; \ |
405 clazz->get_advances = get_advances_; \ | 404 clazz->get_advances = get_advances_; \ |
406 \ | 405 \ |
407 clazz->request_size = request_size_; \ | 406 clazz->request_size = request_size_; \ |
408 clazz->select_size = select_size_; \ | 407 clazz->select_size = select_size_; \ |
409 \ | 408 \ |
410 *output_class = (FT_Module_Class*)clazz; \ | 409 *output_class = (FT_Module_Class*)clazz; \ |
411 return FT_Err_Ok; \ | 410 return FT_Err_Ok; \ |
412 } | 411 } |
413 | 412 |
414 | 413 |
415 #endif /* FT_CONFIG_OPTION_PIC */ | 414 #endif /* FT_CONFIG_OPTION_PIC */ |
416 | 415 |
417 FT_END_HEADER | 416 FT_END_HEADER |
418 | 417 |
419 #endif /* __FTDRIVER_H__ */ | 418 #endif /* __FTDRIVER_H__ */ |
420 | 419 |
421 | 420 |
422 /* END */ | 421 /* END */ |
OLD | NEW |