|
|
|||
Warning, file /include/freetype2/freetype/ftmodapi.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************** 0002 * 0003 * ftmodapi.h 0004 * 0005 * FreeType modules public interface (specification). 0006 * 0007 * Copyright (C) 1996-2023 by 0008 * David Turner, Robert Wilhelm, and Werner Lemberg. 0009 * 0010 * This file is part of the FreeType project, and may only be used, 0011 * modified, and distributed under the terms of the FreeType project 0012 * license, LICENSE.TXT. By continuing to use, modify, or distribute 0013 * this file you indicate that you have read the license and 0014 * understand and accept it fully. 0015 * 0016 */ 0017 0018 0019 #ifndef FTMODAPI_H_ 0020 #define FTMODAPI_H_ 0021 0022 0023 #include <freetype/freetype.h> 0024 0025 #ifdef FREETYPE_H 0026 #error "freetype.h of FreeType 1 has been loaded!" 0027 #error "Please fix the directory search order for header files" 0028 #error "so that freetype.h of FreeType 2 is found first." 0029 #endif 0030 0031 0032 FT_BEGIN_HEADER 0033 0034 0035 /************************************************************************** 0036 * 0037 * @section: 0038 * module_management 0039 * 0040 * @title: 0041 * Module Management 0042 * 0043 * @abstract: 0044 * How to add, upgrade, remove, and control modules from FreeType. 0045 * 0046 * @description: 0047 * The definitions below are used to manage modules within FreeType. 0048 * Internal and external modules can be added, upgraded, and removed at 0049 * runtime. For example, an alternative renderer or proprietary font 0050 * driver can be registered and prioritized. Additionally, some module 0051 * properties can also be controlled. 0052 * 0053 * Here is a list of existing values of the `module_name` field in the 0054 * @FT_Module_Class structure. 0055 * 0056 * ``` 0057 * autofitter 0058 * bdf 0059 * cff 0060 * gxvalid 0061 * otvalid 0062 * pcf 0063 * pfr 0064 * psaux 0065 * pshinter 0066 * psnames 0067 * raster1 0068 * sfnt 0069 * smooth 0070 * truetype 0071 * type1 0072 * type42 0073 * t1cid 0074 * winfonts 0075 * ``` 0076 * 0077 * Note that the FreeType Cache sub-system is not a FreeType module. 0078 * 0079 * @order: 0080 * FT_Module 0081 * FT_Module_Constructor 0082 * FT_Module_Destructor 0083 * FT_Module_Requester 0084 * FT_Module_Class 0085 * 0086 * FT_Add_Module 0087 * FT_Get_Module 0088 * FT_Remove_Module 0089 * FT_Add_Default_Modules 0090 * 0091 * FT_FACE_DRIVER_NAME 0092 * FT_Property_Set 0093 * FT_Property_Get 0094 * FT_Set_Default_Properties 0095 * 0096 * FT_New_Library 0097 * FT_Done_Library 0098 * FT_Reference_Library 0099 * 0100 * FT_Renderer 0101 * FT_Renderer_Class 0102 * 0103 * FT_Get_Renderer 0104 * FT_Set_Renderer 0105 * 0106 * FT_Set_Debug_Hook 0107 * 0108 */ 0109 0110 0111 /* module bit flags */ 0112 #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */ 0113 #define FT_MODULE_RENDERER 2 /* this module is a renderer */ 0114 #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */ 0115 #define FT_MODULE_STYLER 8 /* this module is a styler */ 0116 0117 #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */ 0118 /* scalable fonts */ 0119 #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */ 0120 /* support vector outlines */ 0121 #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */ 0122 /* own hinter */ 0123 #define FT_MODULE_DRIVER_HINTS_LIGHTLY 0x800 /* the driver's hinter */ 0124 /* produces LIGHT hints */ 0125 0126 0127 /* deprecated values */ 0128 #define ft_module_font_driver FT_MODULE_FONT_DRIVER 0129 #define ft_module_renderer FT_MODULE_RENDERER 0130 #define ft_module_hinter FT_MODULE_HINTER 0131 #define ft_module_styler FT_MODULE_STYLER 0132 0133 #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE 0134 #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES 0135 #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER 0136 #define ft_module_driver_hints_lightly FT_MODULE_DRIVER_HINTS_LIGHTLY 0137 0138 0139 typedef FT_Pointer FT_Module_Interface; 0140 0141 0142 /************************************************************************** 0143 * 0144 * @functype: 0145 * FT_Module_Constructor 0146 * 0147 * @description: 0148 * A function used to initialize (not create) a new module object. 0149 * 0150 * @input: 0151 * module :: 0152 * The module to initialize. 0153 */ 0154 typedef FT_Error 0155 (*FT_Module_Constructor)( FT_Module module ); 0156 0157 0158 /************************************************************************** 0159 * 0160 * @functype: 0161 * FT_Module_Destructor 0162 * 0163 * @description: 0164 * A function used to finalize (not destroy) a given module object. 0165 * 0166 * @input: 0167 * module :: 0168 * The module to finalize. 0169 */ 0170 typedef void 0171 (*FT_Module_Destructor)( FT_Module module ); 0172 0173 0174 /************************************************************************** 0175 * 0176 * @functype: 0177 * FT_Module_Requester 0178 * 0179 * @description: 0180 * A function used to query a given module for a specific interface. 0181 * 0182 * @input: 0183 * module :: 0184 * The module to be searched. 0185 * 0186 * name :: 0187 * The name of the interface in the module. 0188 */ 0189 typedef FT_Module_Interface 0190 (*FT_Module_Requester)( FT_Module module, 0191 const char* name ); 0192 0193 0194 /************************************************************************** 0195 * 0196 * @struct: 0197 * FT_Module_Class 0198 * 0199 * @description: 0200 * The module class descriptor. While being a public structure necessary 0201 * for FreeType's module bookkeeping, most of the fields are essentially 0202 * internal, not to be used directly by an application. 0203 * 0204 * @fields: 0205 * module_flags :: 0206 * Bit flags describing the module. 0207 * 0208 * module_size :: 0209 * The size of one module object/instance in bytes. 0210 * 0211 * module_name :: 0212 * The name of the module. 0213 * 0214 * module_version :: 0215 * The version, as a 16.16 fixed number (major.minor). 0216 * 0217 * module_requires :: 0218 * The version of FreeType this module requires, as a 16.16 fixed 0219 * number (major.minor). Starts at version 2.0, i.e., 0x20000. 0220 * 0221 * module_interface :: 0222 * A typeless pointer to a structure (which varies between different 0223 * modules) that holds the module's interface functions. This is 0224 * essentially what `get_interface` returns. 0225 * 0226 * module_init :: 0227 * The initializing function. 0228 * 0229 * module_done :: 0230 * The finalizing function. 0231 * 0232 * get_interface :: 0233 * The interface requesting function. 0234 */ 0235 typedef struct FT_Module_Class_ 0236 { 0237 FT_ULong module_flags; 0238 FT_Long module_size; 0239 const FT_String* module_name; 0240 FT_Fixed module_version; 0241 FT_Fixed module_requires; 0242 0243 const void* module_interface; 0244 0245 FT_Module_Constructor module_init; 0246 FT_Module_Destructor module_done; 0247 FT_Module_Requester get_interface; 0248 0249 } FT_Module_Class; 0250 0251 0252 /************************************************************************** 0253 * 0254 * @function: 0255 * FT_Add_Module 0256 * 0257 * @description: 0258 * Add a new module to a given library instance. 0259 * 0260 * @inout: 0261 * library :: 0262 * A handle to the library object. 0263 * 0264 * @input: 0265 * clazz :: 0266 * A pointer to class descriptor for the module. 0267 * 0268 * @return: 0269 * FreeType error code. 0~means success. 0270 * 0271 * @note: 0272 * An error will be returned if a module already exists by that name, or 0273 * if the module requires a version of FreeType that is too great. 0274 */ 0275 FT_EXPORT( FT_Error ) 0276 FT_Add_Module( FT_Library library, 0277 const FT_Module_Class* clazz ); 0278 0279 0280 /************************************************************************** 0281 * 0282 * @function: 0283 * FT_Get_Module 0284 * 0285 * @description: 0286 * Find a module by its name. 0287 * 0288 * @input: 0289 * library :: 0290 * A handle to the library object. 0291 * 0292 * module_name :: 0293 * The module's name (as an ASCII string). 0294 * 0295 * @return: 0296 * A module handle. 0~if none was found. 0297 * 0298 * @note: 0299 * FreeType's internal modules aren't documented very well, and you 0300 * should look up the source code for details. 0301 */ 0302 FT_EXPORT( FT_Module ) 0303 FT_Get_Module( FT_Library library, 0304 const char* module_name ); 0305 0306 0307 /************************************************************************** 0308 * 0309 * @function: 0310 * FT_Remove_Module 0311 * 0312 * @description: 0313 * Remove a given module from a library instance. 0314 * 0315 * @inout: 0316 * library :: 0317 * A handle to a library object. 0318 * 0319 * @input: 0320 * module :: 0321 * A handle to a module object. 0322 * 0323 * @return: 0324 * FreeType error code. 0~means success. 0325 * 0326 * @note: 0327 * The module object is destroyed by the function in case of success. 0328 */ 0329 FT_EXPORT( FT_Error ) 0330 FT_Remove_Module( FT_Library library, 0331 FT_Module module ); 0332 0333 0334 /************************************************************************** 0335 * 0336 * @macro: 0337 * FT_FACE_DRIVER_NAME 0338 * 0339 * @description: 0340 * A macro that retrieves the name of a font driver from a face object. 0341 * 0342 * @note: 0343 * The font driver name is a valid `module_name` for @FT_Property_Set 0344 * and @FT_Property_Get. This is not the same as @FT_Get_Font_Format. 0345 * 0346 * @since: 0347 * 2.11 0348 * 0349 */ 0350 #define FT_FACE_DRIVER_NAME( face ) \ 0351 ( ( *FT_REINTERPRET_CAST( FT_Module_Class**, \ 0352 ( face )->driver ) )->module_name ) 0353 0354 0355 /************************************************************************** 0356 * 0357 * @function: 0358 * FT_Property_Set 0359 * 0360 * @description: 0361 * Set a property for a given module. 0362 * 0363 * @input: 0364 * library :: 0365 * A handle to the library the module is part of. 0366 * 0367 * module_name :: 0368 * The module name. 0369 * 0370 * property_name :: 0371 * The property name. Properties are described in section 0372 * @properties. 0373 * 0374 * Note that only a few modules have properties. 0375 * 0376 * value :: 0377 * A generic pointer to a variable or structure that gives the new 0378 * value of the property. The exact definition of `value` is 0379 * dependent on the property; see section @properties. 0380 * 0381 * @return: 0382 * FreeType error code. 0~means success. 0383 * 0384 * @note: 0385 * If `module_name` isn't a valid module name, or `property_name` 0386 * doesn't specify a valid property, or if `value` doesn't represent a 0387 * valid value for the given property, an error is returned. 0388 * 0389 * The following example sets property 'bar' (a simple integer) in 0390 * module 'foo' to value~1. 0391 * 0392 * ``` 0393 * FT_UInt bar; 0394 * 0395 * 0396 * bar = 1; 0397 * FT_Property_Set( library, "foo", "bar", &bar ); 0398 * ``` 0399 * 0400 * Note that the FreeType Cache sub-system doesn't recognize module 0401 * property changes. To avoid glyph lookup confusion within the cache 0402 * you should call @FTC_Manager_Reset to completely flush the cache if a 0403 * module property gets changed after @FTC_Manager_New has been called. 0404 * 0405 * It is not possible to set properties of the FreeType Cache sub-system 0406 * itself with FT_Property_Set; use @FTC_Property_Set instead. 0407 * 0408 * @since: 0409 * 2.4.11 0410 * 0411 */ 0412 FT_EXPORT( FT_Error ) 0413 FT_Property_Set( FT_Library library, 0414 const FT_String* module_name, 0415 const FT_String* property_name, 0416 const void* value ); 0417 0418 0419 /************************************************************************** 0420 * 0421 * @function: 0422 * FT_Property_Get 0423 * 0424 * @description: 0425 * Get a module's property value. 0426 * 0427 * @input: 0428 * library :: 0429 * A handle to the library the module is part of. 0430 * 0431 * module_name :: 0432 * The module name. 0433 * 0434 * property_name :: 0435 * The property name. Properties are described in section 0436 * @properties. 0437 * 0438 * @inout: 0439 * value :: 0440 * A generic pointer to a variable or structure that gives the value 0441 * of the property. The exact definition of `value` is dependent on 0442 * the property; see section @properties. 0443 * 0444 * @return: 0445 * FreeType error code. 0~means success. 0446 * 0447 * @note: 0448 * If `module_name` isn't a valid module name, or `property_name` 0449 * doesn't specify a valid property, or if `value` doesn't represent a 0450 * valid value for the given property, an error is returned. 0451 * 0452 * The following example gets property 'baz' (a range) in module 'foo'. 0453 * 0454 * ``` 0455 * typedef range_ 0456 * { 0457 * FT_Int32 min; 0458 * FT_Int32 max; 0459 * 0460 * } range; 0461 * 0462 * range baz; 0463 * 0464 * 0465 * FT_Property_Get( library, "foo", "baz", &baz ); 0466 * ``` 0467 * 0468 * It is not possible to retrieve properties of the FreeType Cache 0469 * sub-system with FT_Property_Get; use @FTC_Property_Get instead. 0470 * 0471 * @since: 0472 * 2.4.11 0473 * 0474 */ 0475 FT_EXPORT( FT_Error ) 0476 FT_Property_Get( FT_Library library, 0477 const FT_String* module_name, 0478 const FT_String* property_name, 0479 void* value ); 0480 0481 0482 /************************************************************************** 0483 * 0484 * @function: 0485 * FT_Set_Default_Properties 0486 * 0487 * @description: 0488 * If compilation option `FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES` is 0489 * set, this function reads the `FREETYPE_PROPERTIES` environment 0490 * variable to control driver properties. See section @properties for 0491 * more. 0492 * 0493 * If the compilation option is not set, this function does nothing. 0494 * 0495 * `FREETYPE_PROPERTIES` has the following syntax form (broken here into 0496 * multiple lines for better readability). 0497 * 0498 * ``` 0499 * <optional whitespace> 0500 * <module-name1> ':' 0501 * <property-name1> '=' <property-value1> 0502 * <whitespace> 0503 * <module-name2> ':' 0504 * <property-name2> '=' <property-value2> 0505 * ... 0506 * ``` 0507 * 0508 * Example: 0509 * 0510 * ``` 0511 * FREETYPE_PROPERTIES=truetype:interpreter-version=35 \ 0512 * cff:no-stem-darkening=0 0513 * ``` 0514 * 0515 * @inout: 0516 * library :: 0517 * A handle to a new library object. 0518 * 0519 * @since: 0520 * 2.8 0521 */ 0522 FT_EXPORT( void ) 0523 FT_Set_Default_Properties( FT_Library library ); 0524 0525 0526 /************************************************************************** 0527 * 0528 * @function: 0529 * FT_Reference_Library 0530 * 0531 * @description: 0532 * A counter gets initialized to~1 at the time an @FT_Library structure 0533 * is created. This function increments the counter. @FT_Done_Library 0534 * then only destroys a library if the counter is~1, otherwise it simply 0535 * decrements the counter. 0536 * 0537 * This function helps in managing life-cycles of structures that 0538 * reference @FT_Library objects. 0539 * 0540 * @input: 0541 * library :: 0542 * A handle to a target library object. 0543 * 0544 * @return: 0545 * FreeType error code. 0~means success. 0546 * 0547 * @since: 0548 * 2.4.2 0549 */ 0550 FT_EXPORT( FT_Error ) 0551 FT_Reference_Library( FT_Library library ); 0552 0553 0554 /************************************************************************** 0555 * 0556 * @function: 0557 * FT_New_Library 0558 * 0559 * @description: 0560 * This function is used to create a new FreeType library instance from a 0561 * given memory object. It is thus possible to use libraries with 0562 * distinct memory allocators within the same program. Note, however, 0563 * that the used @FT_Memory structure is expected to remain valid for the 0564 * life of the @FT_Library object. 0565 * 0566 * Normally, you would call this function (followed by a call to 0567 * @FT_Add_Default_Modules or a series of calls to @FT_Add_Module, and a 0568 * call to @FT_Set_Default_Properties) instead of @FT_Init_FreeType to 0569 * initialize the FreeType library. 0570 * 0571 * Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a library 0572 * instance. 0573 * 0574 * @input: 0575 * memory :: 0576 * A handle to the original memory object. 0577 * 0578 * @output: 0579 * alibrary :: 0580 * A pointer to handle of a new library object. 0581 * 0582 * @return: 0583 * FreeType error code. 0~means success. 0584 * 0585 * @note: 0586 * See the discussion of reference counters in the description of 0587 * @FT_Reference_Library. 0588 */ 0589 FT_EXPORT( FT_Error ) 0590 FT_New_Library( FT_Memory memory, 0591 FT_Library *alibrary ); 0592 0593 0594 /************************************************************************** 0595 * 0596 * @function: 0597 * FT_Done_Library 0598 * 0599 * @description: 0600 * Discard a given library object. This closes all drivers and discards 0601 * all resource objects. 0602 * 0603 * @input: 0604 * library :: 0605 * A handle to the target library. 0606 * 0607 * @return: 0608 * FreeType error code. 0~means success. 0609 * 0610 * @note: 0611 * See the discussion of reference counters in the description of 0612 * @FT_Reference_Library. 0613 */ 0614 FT_EXPORT( FT_Error ) 0615 FT_Done_Library( FT_Library library ); 0616 0617 0618 /************************************************************************** 0619 * 0620 * @functype: 0621 * FT_DebugHook_Func 0622 * 0623 * @description: 0624 * A drop-in replacement (or rather a wrapper) for the bytecode or 0625 * charstring interpreter's main loop function. 0626 * 0627 * Its job is essentially 0628 * 0629 * - to activate debug mode to enforce single-stepping, 0630 * 0631 * - to call the main loop function to interpret the next opcode, and 0632 * 0633 * - to show the changed context to the user. 0634 * 0635 * An example for such a main loop function is `TT_RunIns` (declared in 0636 * FreeType's internal header file `src/truetype/ttinterp.h`). 0637 * 0638 * Have a look at the source code of the `ttdebug` FreeType demo program 0639 * for an example of a drop-in replacement. 0640 * 0641 * @inout: 0642 * arg :: 0643 * A typeless pointer, to be cast to the main loop function's data 0644 * structure (which depends on the font module). For TrueType fonts 0645 * it is bytecode interpreter's execution context, `TT_ExecContext`, 0646 * which is declared in FreeType's internal header file `tttypes.h`. 0647 */ 0648 typedef FT_Error 0649 (*FT_DebugHook_Func)( void* arg ); 0650 0651 0652 /************************************************************************** 0653 * 0654 * @enum: 0655 * FT_DEBUG_HOOK_XXX 0656 * 0657 * @description: 0658 * A list of named debug hook indices. 0659 * 0660 * @values: 0661 * FT_DEBUG_HOOK_TRUETYPE:: 0662 * This hook index identifies the TrueType bytecode debugger. 0663 */ 0664 #define FT_DEBUG_HOOK_TRUETYPE 0 0665 0666 0667 /************************************************************************** 0668 * 0669 * @function: 0670 * FT_Set_Debug_Hook 0671 * 0672 * @description: 0673 * Set a debug hook function for debugging the interpreter of a font 0674 * format. 0675 * 0676 * While this is a public API function, an application needs access to 0677 * FreeType's internal header files to do something useful. 0678 * 0679 * Have a look at the source code of the `ttdebug` FreeType demo program 0680 * for an example of its usage. 0681 * 0682 * @inout: 0683 * library :: 0684 * A handle to the library object. 0685 * 0686 * @input: 0687 * hook_index :: 0688 * The index of the debug hook. You should use defined enumeration 0689 * macros like @FT_DEBUG_HOOK_TRUETYPE. 0690 * 0691 * debug_hook :: 0692 * The function used to debug the interpreter. 0693 * 0694 * @note: 0695 * Currently, four debug hook slots are available, but only one (for the 0696 * TrueType interpreter) is defined. 0697 */ 0698 FT_EXPORT( void ) 0699 FT_Set_Debug_Hook( FT_Library library, 0700 FT_UInt hook_index, 0701 FT_DebugHook_Func debug_hook ); 0702 0703 0704 /************************************************************************** 0705 * 0706 * @function: 0707 * FT_Add_Default_Modules 0708 * 0709 * @description: 0710 * Add the set of default drivers to a given library object. This is 0711 * only useful when you create a library object with @FT_New_Library 0712 * (usually to plug a custom memory manager). 0713 * 0714 * @inout: 0715 * library :: 0716 * A handle to a new library object. 0717 */ 0718 FT_EXPORT( void ) 0719 FT_Add_Default_Modules( FT_Library library ); 0720 0721 0722 0723 /************************************************************************** 0724 * 0725 * @section: 0726 * truetype_engine 0727 * 0728 * @title: 0729 * The TrueType Engine 0730 * 0731 * @abstract: 0732 * TrueType bytecode support. 0733 * 0734 * @description: 0735 * This section contains a function used to query the level of TrueType 0736 * bytecode support compiled in this version of the library. 0737 * 0738 */ 0739 0740 0741 /************************************************************************** 0742 * 0743 * @enum: 0744 * FT_TrueTypeEngineType 0745 * 0746 * @description: 0747 * A list of values describing which kind of TrueType bytecode engine is 0748 * implemented in a given FT_Library instance. It is used by the 0749 * @FT_Get_TrueType_Engine_Type function. 0750 * 0751 * @values: 0752 * FT_TRUETYPE_ENGINE_TYPE_NONE :: 0753 * The library doesn't implement any kind of bytecode interpreter. 0754 * 0755 * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED :: 0756 * Deprecated and removed. 0757 * 0758 * FT_TRUETYPE_ENGINE_TYPE_PATENTED :: 0759 * The library implements a bytecode interpreter that covers the full 0760 * instruction set of the TrueType virtual machine (this was governed 0761 * by patents until May 2010, hence the name). 0762 * 0763 * @since: 0764 * 2.2 0765 * 0766 */ 0767 typedef enum FT_TrueTypeEngineType_ 0768 { 0769 FT_TRUETYPE_ENGINE_TYPE_NONE = 0, 0770 FT_TRUETYPE_ENGINE_TYPE_UNPATENTED, 0771 FT_TRUETYPE_ENGINE_TYPE_PATENTED 0772 0773 } FT_TrueTypeEngineType; 0774 0775 0776 /************************************************************************** 0777 * 0778 * @function: 0779 * FT_Get_TrueType_Engine_Type 0780 * 0781 * @description: 0782 * Return an @FT_TrueTypeEngineType value to indicate which level of the 0783 * TrueType virtual machine a given library instance supports. 0784 * 0785 * @input: 0786 * library :: 0787 * A library instance. 0788 * 0789 * @return: 0790 * A value indicating which level is supported. 0791 * 0792 * @since: 0793 * 2.2 0794 * 0795 */ 0796 FT_EXPORT( FT_TrueTypeEngineType ) 0797 FT_Get_TrueType_Engine_Type( FT_Library library ); 0798 0799 /* */ 0800 0801 0802 FT_END_HEADER 0803 0804 #endif /* FTMODAPI_H_ */ 0805 0806 0807 /* END */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|