/modules/freetype2/src/pshinter/pshmod.c

http://github.com/zpao/v8monkey · C · 118 lines · 64 code · 31 blank · 23 comment · 0 complexity · 7eebe1cd2dcf398e42205b0cdd4a5932 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* pshmod.c */
  4. /* */
  5. /* FreeType PostScript hinter module implementation (body). */
  6. /* */
  7. /* Copyright 2001, 2002, 2007 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. #include <ft2build.h>
  18. #include FT_INTERNAL_OBJECTS_H
  19. #include "pshrec.h"
  20. #include "pshalgo.h"
  21. #include "pshpic.h"
  22. /* the Postscript Hinter module structure */
  23. typedef struct PS_Hinter_Module_Rec_
  24. {
  25. FT_ModuleRec root;
  26. PS_HintsRec ps_hints;
  27. PSH_Globals_FuncsRec globals_funcs;
  28. T1_Hints_FuncsRec t1_funcs;
  29. T2_Hints_FuncsRec t2_funcs;
  30. } PS_Hinter_ModuleRec, *PS_Hinter_Module;
  31. /* finalize module */
  32. FT_CALLBACK_DEF( void )
  33. ps_hinter_done( PS_Hinter_Module module )
  34. {
  35. module->t1_funcs.hints = NULL;
  36. module->t2_funcs.hints = NULL;
  37. ps_hints_done( &module->ps_hints );
  38. }
  39. /* initialize module, create hints recorder and the interface */
  40. FT_CALLBACK_DEF( FT_Error )
  41. ps_hinter_init( PS_Hinter_Module module )
  42. {
  43. FT_Memory memory = module->root.memory;
  44. void* ph = &module->ps_hints;
  45. ps_hints_init( &module->ps_hints, memory );
  46. psh_globals_funcs_init( &module->globals_funcs );
  47. t1_hints_funcs_init( &module->t1_funcs );
  48. module->t1_funcs.hints = (T1_Hints)ph;
  49. t2_hints_funcs_init( &module->t2_funcs );
  50. module->t2_funcs.hints = (T2_Hints)ph;
  51. return 0;
  52. }
  53. /* returns global hints interface */
  54. FT_CALLBACK_DEF( PSH_Globals_Funcs )
  55. pshinter_get_globals_funcs( FT_Module module )
  56. {
  57. return &((PS_Hinter_Module)module)->globals_funcs;
  58. }
  59. /* return Type 1 hints interface */
  60. FT_CALLBACK_DEF( T1_Hints_Funcs )
  61. pshinter_get_t1_funcs( FT_Module module )
  62. {
  63. return &((PS_Hinter_Module)module)->t1_funcs;
  64. }
  65. /* return Type 2 hints interface */
  66. FT_CALLBACK_DEF( T2_Hints_Funcs )
  67. pshinter_get_t2_funcs( FT_Module module )
  68. {
  69. return &((PS_Hinter_Module)module)->t2_funcs;
  70. }
  71. FT_DEFINE_PSHINTER_INTERFACE(pshinter_interface,
  72. pshinter_get_globals_funcs,
  73. pshinter_get_t1_funcs,
  74. pshinter_get_t2_funcs
  75. )
  76. FT_DEFINE_MODULE(pshinter_module_class,
  77. 0,
  78. sizeof ( PS_Hinter_ModuleRec ),
  79. "pshinter",
  80. 0x10000L,
  81. 0x20000L,
  82. &FTPSHINTER_INTERFACE_GET, /* module-specific interface */
  83. (FT_Module_Constructor)ps_hinter_init,
  84. (FT_Module_Destructor) ps_hinter_done,
  85. (FT_Module_Requester) 0 /* no additional interface for now */
  86. )
  87. /* END */