/src/freetype/include/freetype/ftmodapi.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 483 lines · 78 code · 61 blank · 344 comment · 0 complexity · 38125f01d93d059734b5b079d6fcc5d7 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftmodapi.h */
  4. /* */
  5. /* FreeType modules public interface (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2002, 2003, 2006, 2008, 2009, 2010 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  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 */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef __FTMODAPI_H__
  18. #define __FTMODAPI_H__
  19. #include <ft2build.h>
  20. #include FT_FREETYPE_H
  21. #ifdef FREETYPE_H
  22. #error "freetype.h of FreeType 1 has been loaded!"
  23. #error "Please fix the directory search order for header files"
  24. #error "so that freetype.h of FreeType 2 is found first."
  25. #endif
  26. FT_BEGIN_HEADER
  27. /*************************************************************************/
  28. /* */
  29. /* <Section> */
  30. /* module_management */
  31. /* */
  32. /* <Title> */
  33. /* Module Management */
  34. /* */
  35. /* <Abstract> */
  36. /* How to add, upgrade, and remove modules from FreeType. */
  37. /* */
  38. /* <Description> */
  39. /* The definitions below are used to manage modules within FreeType. */
  40. /* Modules can be added, upgraded, and removed at runtime. */
  41. /* */
  42. /*************************************************************************/
  43. /* module bit flags */
  44. #define FT_MODULE_FONT_DRIVER 1 /* this module is a font driver */
  45. #define FT_MODULE_RENDERER 2 /* this module is a renderer */
  46. #define FT_MODULE_HINTER 4 /* this module is a glyph hinter */
  47. #define FT_MODULE_STYLER 8 /* this module is a styler */
  48. #define FT_MODULE_DRIVER_SCALABLE 0x100 /* the driver supports */
  49. /* scalable fonts */
  50. #define FT_MODULE_DRIVER_NO_OUTLINES 0x200 /* the driver does not */
  51. /* support vector outlines */
  52. #define FT_MODULE_DRIVER_HAS_HINTER 0x400 /* the driver provides its */
  53. /* own hinter */
  54. /* deprecated values */
  55. #define ft_module_font_driver FT_MODULE_FONT_DRIVER
  56. #define ft_module_renderer FT_MODULE_RENDERER
  57. #define ft_module_hinter FT_MODULE_HINTER
  58. #define ft_module_styler FT_MODULE_STYLER
  59. #define ft_module_driver_scalable FT_MODULE_DRIVER_SCALABLE
  60. #define ft_module_driver_no_outlines FT_MODULE_DRIVER_NO_OUTLINES
  61. #define ft_module_driver_has_hinter FT_MODULE_DRIVER_HAS_HINTER
  62. typedef FT_Pointer FT_Module_Interface;
  63. /*************************************************************************/
  64. /* */
  65. /* <FuncType> */
  66. /* FT_Module_Constructor */
  67. /* */
  68. /* <Description> */
  69. /* A function used to initialize (not create) a new module object. */
  70. /* */
  71. /* <Input> */
  72. /* module :: The module to initialize. */
  73. /* */
  74. typedef FT_Error
  75. (*FT_Module_Constructor)( FT_Module module );
  76. /*************************************************************************/
  77. /* */
  78. /* <FuncType> */
  79. /* FT_Module_Destructor */
  80. /* */
  81. /* <Description> */
  82. /* A function used to finalize (not destroy) a given module object. */
  83. /* */
  84. /* <Input> */
  85. /* module :: The module to finalize. */
  86. /* */
  87. typedef void
  88. (*FT_Module_Destructor)( FT_Module module );
  89. /*************************************************************************/
  90. /* */
  91. /* <FuncType> */
  92. /* FT_Module_Requester */
  93. /* */
  94. /* <Description> */
  95. /* A function used to query a given module for a specific interface. */
  96. /* */
  97. /* <Input> */
  98. /* module :: The module to finalize. */
  99. /* */
  100. /* name :: The name of the interface in the module. */
  101. /* */
  102. typedef FT_Module_Interface
  103. (*FT_Module_Requester)( FT_Module module,
  104. const char* name );
  105. /*************************************************************************/
  106. /* */
  107. /* <Struct> */
  108. /* FT_Module_Class */
  109. /* */
  110. /* <Description> */
  111. /* The module class descriptor. */
  112. /* */
  113. /* <Fields> */
  114. /* module_flags :: Bit flags describing the module. */
  115. /* */
  116. /* module_size :: The size of one module object/instance in */
  117. /* bytes. */
  118. /* */
  119. /* module_name :: The name of the module. */
  120. /* */
  121. /* module_version :: The version, as a 16.16 fixed number */
  122. /* (major.minor). */
  123. /* */
  124. /* module_requires :: The version of FreeType this module requires, */
  125. /* as a 16.16 fixed number (major.minor). Starts */
  126. /* at version 2.0, i.e., 0x20000. */
  127. /* */
  128. /* module_init :: The initializing function. */
  129. /* */
  130. /* module_done :: The finalizing function. */
  131. /* */
  132. /* get_interface :: The interface requesting function. */
  133. /* */
  134. typedef struct FT_Module_Class_
  135. {
  136. FT_ULong module_flags;
  137. FT_Long module_size;
  138. const FT_String* module_name;
  139. FT_Fixed module_version;
  140. FT_Fixed module_requires;
  141. const void* module_interface;
  142. FT_Module_Constructor module_init;
  143. FT_Module_Destructor module_done;
  144. FT_Module_Requester get_interface;
  145. } FT_Module_Class;
  146. /*************************************************************************/
  147. /* */
  148. /* <Function> */
  149. /* FT_Add_Module */
  150. /* */
  151. /* <Description> */
  152. /* Add a new module to a given library instance. */
  153. /* */
  154. /* <InOut> */
  155. /* library :: A handle to the library object. */
  156. /* */
  157. /* <Input> */
  158. /* clazz :: A pointer to class descriptor for the module. */
  159. /* */
  160. /* <Return> */
  161. /* FreeType error code. 0~means success. */
  162. /* */
  163. /* <Note> */
  164. /* An error will be returned if a module already exists by that name, */
  165. /* or if the module requires a version of FreeType that is too great. */
  166. /* */
  167. FT_EXPORT( FT_Error )
  168. FT_Add_Module( FT_Library library,
  169. const FT_Module_Class* clazz );
  170. /*************************************************************************/
  171. /* */
  172. /* <Function> */
  173. /* FT_Get_Module */
  174. /* */
  175. /* <Description> */
  176. /* Find a module by its name. */
  177. /* */
  178. /* <Input> */
  179. /* library :: A handle to the library object. */
  180. /* */
  181. /* module_name :: The module's name (as an ASCII string). */
  182. /* */
  183. /* <Return> */
  184. /* A module handle. 0~if none was found. */
  185. /* */
  186. /* <Note> */
  187. /* FreeType's internal modules aren't documented very well, and you */
  188. /* should look up the source code for details. */
  189. /* */
  190. FT_EXPORT( FT_Module )
  191. FT_Get_Module( FT_Library library,
  192. const char* module_name );
  193. /*************************************************************************/
  194. /* */
  195. /* <Function> */
  196. /* FT_Remove_Module */
  197. /* */
  198. /* <Description> */
  199. /* Remove a given module from a library instance. */
  200. /* */
  201. /* <InOut> */
  202. /* library :: A handle to a library object. */
  203. /* */
  204. /* <Input> */
  205. /* module :: A handle to a module object. */
  206. /* */
  207. /* <Return> */
  208. /* FreeType error code. 0~means success. */
  209. /* */
  210. /* <Note> */
  211. /* The module object is destroyed by the function in case of success. */
  212. /* */
  213. FT_EXPORT( FT_Error )
  214. FT_Remove_Module( FT_Library library,
  215. FT_Module module );
  216. /*************************************************************************/
  217. /* */
  218. /* <Function> */
  219. /* FT_Reference_Library */
  220. /* */
  221. /* <Description> */
  222. /* A counter gets initialized to~1 at the time an @FT_Library */
  223. /* structure is created. This function increments the counter. */
  224. /* @FT_Done_Library then only destroys a library if the counter is~1, */
  225. /* otherwise it simply decrements the counter. */
  226. /* */
  227. /* This function helps in managing life-cycles of structures which */
  228. /* reference @FT_Library objects. */
  229. /* */
  230. /* <Input> */
  231. /* library :: A handle to a target library object. */
  232. /* */
  233. /* <Return> */
  234. /* FreeType error code. 0~means success. */
  235. /* */
  236. /* <Since> */
  237. /* 2.4.2 */
  238. /* */
  239. FT_EXPORT( FT_Error )
  240. FT_Reference_Library( FT_Library library );
  241. /*************************************************************************/
  242. /* */
  243. /* <Function> */
  244. /* FT_New_Library */
  245. /* */
  246. /* <Description> */
  247. /* This function is used to create a new FreeType library instance */
  248. /* from a given memory object. It is thus possible to use libraries */
  249. /* with distinct memory allocators within the same program. */
  250. /* */
  251. /* Normally, you would call this function (followed by a call to */
  252. /* @FT_Add_Default_Modules or a series of calls to @FT_Add_Module) */
  253. /* instead of @FT_Init_FreeType to initialize the FreeType library. */
  254. /* */
  255. /* Don't use @FT_Done_FreeType but @FT_Done_Library to destroy a */
  256. /* library instance. */
  257. /* */
  258. /* <Input> */
  259. /* memory :: A handle to the original memory object. */
  260. /* */
  261. /* <Output> */
  262. /* alibrary :: A pointer to handle of a new library object. */
  263. /* */
  264. /* <Return> */
  265. /* FreeType error code. 0~means success. */
  266. /* */
  267. /* <Note> */
  268. /* See the discussion of reference counters in the description of */
  269. /* @FT_Reference_Library. */
  270. /* */
  271. FT_EXPORT( FT_Error )
  272. FT_New_Library( FT_Memory memory,
  273. FT_Library *alibrary );
  274. /*************************************************************************/
  275. /* */
  276. /* <Function> */
  277. /* FT_Done_Library */
  278. /* */
  279. /* <Description> */
  280. /* Discard a given library object. This closes all drivers and */
  281. /* discards all resource objects. */
  282. /* */
  283. /* <Input> */
  284. /* library :: A handle to the target library. */
  285. /* */
  286. /* <Return> */
  287. /* FreeType error code. 0~means success. */
  288. /* */
  289. /* <Note> */
  290. /* See the discussion of reference counters in the description of */
  291. /* @FT_Reference_Library. */
  292. /* */
  293. FT_EXPORT( FT_Error )
  294. FT_Done_Library( FT_Library library );
  295. /* */
  296. typedef void
  297. (*FT_DebugHook_Func)( void* arg );
  298. /*************************************************************************/
  299. /* */
  300. /* <Function> */
  301. /* FT_Set_Debug_Hook */
  302. /* */
  303. /* <Description> */
  304. /* Set a debug hook function for debugging the interpreter of a font */
  305. /* format. */
  306. /* */
  307. /* <InOut> */
  308. /* library :: A handle to the library object. */
  309. /* */
  310. /* <Input> */
  311. /* hook_index :: The index of the debug hook. You should use the */
  312. /* values defined in `ftobjs.h', e.g., */
  313. /* `FT_DEBUG_HOOK_TRUETYPE'. */
  314. /* */
  315. /* debug_hook :: The function used to debug the interpreter. */
  316. /* */
  317. /* <Note> */
  318. /* Currently, four debug hook slots are available, but only two (for */
  319. /* the TrueType and the Type~1 interpreter) are defined. */
  320. /* */
  321. /* Since the internal headers of FreeType are no longer installed, */
  322. /* the symbol `FT_DEBUG_HOOK_TRUETYPE' isn't available publicly. */
  323. /* This is a bug and will be fixed in a forthcoming release. */
  324. /* */
  325. FT_EXPORT( void )
  326. FT_Set_Debug_Hook( FT_Library library,
  327. FT_UInt hook_index,
  328. FT_DebugHook_Func debug_hook );
  329. /*************************************************************************/
  330. /* */
  331. /* <Function> */
  332. /* FT_Add_Default_Modules */
  333. /* */
  334. /* <Description> */
  335. /* Add the set of default drivers to a given library object. */
  336. /* This is only useful when you create a library object with */
  337. /* @FT_New_Library (usually to plug a custom memory manager). */
  338. /* */
  339. /* <InOut> */
  340. /* library :: A handle to a new library object. */
  341. /* */
  342. FT_EXPORT( void )
  343. FT_Add_Default_Modules( FT_Library library );
  344. /**************************************************************************
  345. *
  346. * @section:
  347. * truetype_engine
  348. *
  349. * @title:
  350. * The TrueType Engine
  351. *
  352. * @abstract:
  353. * TrueType bytecode support.
  354. *
  355. * @description:
  356. * This section contains a function used to query the level of TrueType
  357. * bytecode support compiled in this version of the library.
  358. *
  359. */
  360. /**************************************************************************
  361. *
  362. * @enum:
  363. * FT_TrueTypeEngineType
  364. *
  365. * @description:
  366. * A list of values describing which kind of TrueType bytecode
  367. * engine is implemented in a given FT_Library instance. It is used
  368. * by the @FT_Get_TrueType_Engine_Type function.
  369. *
  370. * @values:
  371. * FT_TRUETYPE_ENGINE_TYPE_NONE ::
  372. * The library doesn't implement any kind of bytecode interpreter.
  373. *
  374. * FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::
  375. * The library implements a bytecode interpreter that doesn't
  376. * support the patented operations of the TrueType virtual machine.
  377. *
  378. * Its main use is to load certain Asian fonts which position and
  379. * scale glyph components with bytecode instructions. It produces
  380. * bad output for most other fonts.
  381. *
  382. * FT_TRUETYPE_ENGINE_TYPE_PATENTED ::
  383. * The library implements a bytecode interpreter that covers
  384. * the full instruction set of the TrueType virtual machine (this
  385. * was governed by patents until May 2010, hence the name).
  386. *
  387. * @since:
  388. * 2.2
  389. *
  390. */
  391. typedef enum FT_TrueTypeEngineType_
  392. {
  393. FT_TRUETYPE_ENGINE_TYPE_NONE = 0,
  394. FT_TRUETYPE_ENGINE_TYPE_UNPATENTED,
  395. FT_TRUETYPE_ENGINE_TYPE_PATENTED
  396. } FT_TrueTypeEngineType;
  397. /**************************************************************************
  398. *
  399. * @func:
  400. * FT_Get_TrueType_Engine_Type
  401. *
  402. * @description:
  403. * Return an @FT_TrueTypeEngineType value to indicate which level of
  404. * the TrueType virtual machine a given library instance supports.
  405. *
  406. * @input:
  407. * library ::
  408. * A library instance.
  409. *
  410. * @return:
  411. * A value indicating which level is supported.
  412. *
  413. * @since:
  414. * 2.2
  415. *
  416. */
  417. FT_EXPORT( FT_TrueTypeEngineType )
  418. FT_Get_TrueType_Engine_Type( FT_Library library );
  419. /* */
  420. FT_END_HEADER
  421. #endif /* __FTMODAPI_H__ */
  422. /* END */