ahmodule.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /***************************************************************************/
  2. /* */
  3. /* ahmodule.c */
  4. /* */
  5. /* Auto-hinting module implementation (declaration). */
  6. /* */
  7. /* Copyright 2000-2001, 2002 Catharon Productions Inc. */
  8. /* Author: David Turner */
  9. /* */
  10. /* This file is part of the Catharon Typography Project and shall only */
  11. /* be used, modified, and distributed under the terms of the Catharon */
  12. /* Open Source License that should come with this file under the name */
  13. /* `CatharonLicense.txt'. By continuing to use, modify, or distribute */
  14. /* this file you indicate that you have read the license and */
  15. /* understand and accept it fully. */
  16. /* */
  17. /* Note that this license is compatible with the FreeType license. */
  18. /* */
  19. /***************************************************************************/
  20. #include <ft2build.h>
  21. #include FT_MODULE_H
  22. #include "ahhint.h"
  23. #ifdef DEBUG_HINTER
  24. AH_Hinter ah_debug_hinter = NULL;
  25. FT_Bool ah_debug_disable_horz = 0;
  26. FT_Bool ah_debug_disable_vert = 0;
  27. #endif
  28. typedef struct FT_AutoHinterRec_
  29. {
  30. FT_ModuleRec root;
  31. AH_Hinter hinter;
  32. } FT_AutoHinterRec;
  33. FT_CALLBACK_DEF( FT_Error )
  34. ft_autohinter_init( FT_AutoHinter module )
  35. {
  36. FT_Error error;
  37. error = ah_hinter_new( module->root.library, &module->hinter );
  38. #ifdef DEBUG_HINTER
  39. if ( !error )
  40. ah_debug_hinter = module->hinter;
  41. #endif
  42. return error;
  43. }
  44. FT_CALLBACK_DEF( void )
  45. ft_autohinter_done( FT_AutoHinter module )
  46. {
  47. ah_hinter_done( module->hinter );
  48. #ifdef DEBUG_HINTER
  49. ah_debug_hinter = NULL;
  50. #endif
  51. }
  52. FT_CALLBACK_DEF( FT_Error )
  53. ft_autohinter_load_glyph( FT_AutoHinter module,
  54. FT_GlyphSlot slot,
  55. FT_Size size,
  56. FT_UInt glyph_index,
  57. FT_Int32 load_flags )
  58. {
  59. return ah_hinter_load_glyph( module->hinter,
  60. slot, size, glyph_index, load_flags );
  61. }
  62. FT_CALLBACK_DEF( void )
  63. ft_autohinter_reset_globals( FT_AutoHinter module,
  64. FT_Face face )
  65. {
  66. FT_UNUSED( module );
  67. if ( face->autohint.data )
  68. ah_hinter_done_face_globals( (AH_Face_Globals)(face->autohint.data) );
  69. }
  70. FT_CALLBACK_DEF( void )
  71. ft_autohinter_get_globals( FT_AutoHinter module,
  72. FT_Face face,
  73. void** global_hints,
  74. long* global_len )
  75. {
  76. ah_hinter_get_global_hints( module->hinter, face,
  77. global_hints, global_len );
  78. }
  79. FT_CALLBACK_DEF( void )
  80. ft_autohinter_done_globals( FT_AutoHinter module,
  81. void* global_hints )
  82. {
  83. ah_hinter_done_global_hints( module->hinter, global_hints );
  84. }
  85. FT_CALLBACK_TABLE_DEF
  86. const FT_AutoHinter_ServiceRec ft_autohinter_service =
  87. {
  88. ft_autohinter_reset_globals,
  89. ft_autohinter_get_globals,
  90. ft_autohinter_done_globals,
  91. ft_autohinter_load_glyph
  92. };
  93. FT_CALLBACK_TABLE_DEF
  94. const FT_Module_Class autohint_module_class =
  95. {
  96. ft_module_hinter,
  97. sizeof ( FT_AutoHinterRec ),
  98. "autohinter",
  99. 0x10000L, /* version 1.0 of the autohinter */
  100. 0x20000L, /* requires FreeType 2.0 or above */
  101. (const void*) &ft_autohinter_service,
  102. (FT_Module_Constructor)ft_autohinter_init,
  103. (FT_Module_Destructor) ft_autohinter_done,
  104. (FT_Module_Requester) 0
  105. };
  106. /* END */