/src/freetype/src/pshinter/pshpic.c

https://bitbucket.org/cabalistic/ogredeps/ · C · 75 lines · 38 code · 16 blank · 21 comment · 3 complexity · 3169a8282d403085e1eaefa58f03f6b1 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* pshpic.c */
  4. /* */
  5. /* The FreeType position independent code services for pshinter module. */
  6. /* */
  7. /* Copyright 2009, 2010 by */
  8. /* Oran Agra and Mickey Gabel. */
  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_FREETYPE_H
  19. #include FT_INTERNAL_OBJECTS_H
  20. #include "pshpic.h"
  21. #include "pshnterr.h"
  22. #ifdef FT_CONFIG_OPTION_PIC
  23. /* forward declaration of PIC init functions from pshmod.c */
  24. void
  25. FT_Init_Class_pshinter_interface( FT_Library library,
  26. PSHinter_Interface* clazz );
  27. void
  28. pshinter_module_class_pic_free( FT_Library library )
  29. {
  30. FT_PIC_Container* pic_container = &library->pic_container;
  31. FT_Memory memory = library->memory;
  32. if ( pic_container->pshinter )
  33. {
  34. FT_FREE( pic_container->pshinter );
  35. pic_container->pshinter = NULL;
  36. }
  37. }
  38. FT_Error
  39. pshinter_module_class_pic_init( FT_Library library )
  40. {
  41. FT_PIC_Container* pic_container = &library->pic_container;
  42. FT_Error error = PSH_Err_Ok;
  43. PSHinterPIC* container;
  44. FT_Memory memory = library->memory;
  45. /* allocate pointer, clear and set global container pointer */
  46. if ( FT_ALLOC ( container, sizeof ( *container ) ) )
  47. return error;
  48. FT_MEM_SET( container, 0, sizeof ( *container ) );
  49. pic_container->pshinter = container;
  50. /* add call to initialization function when you add new scripts */
  51. FT_Init_Class_pshinter_interface(
  52. library, &container->pshinter_interface );
  53. /*Exit:*/
  54. if( error )
  55. pshinter_module_class_pic_free( library );
  56. return error;
  57. }
  58. #endif /* FT_CONFIG_OPTION_PIC */
  59. /* END */