/src/compiler/android-ndk/jni/freetype/src/truetype/ttpic.c

http://ftk.googlecode.com/ · C · 79 lines · 48 code · 11 blank · 20 comment · 5 complexity · 96d36b8ec955e1fef64a3a82a03d9225 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ttpic.c */
  4. /* */
  5. /* The FreeType position independent code services for truetype module. */
  6. /* */
  7. /* Copyright 2009 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 "ttpic.h"
  21. #ifdef FT_CONFIG_OPTION_PIC
  22. /* forward declaration of PIC init functions from ttdriver.c */
  23. FT_Error FT_Create_Class_tt_services( FT_Library, FT_ServiceDescRec**);
  24. void FT_Destroy_Class_tt_services( FT_Library, FT_ServiceDescRec*);
  25. void FT_Init_Class_tt_service_gx_multi_masters(FT_Service_MultiMastersRec*);
  26. void FT_Init_Class_tt_service_truetype_glyf(FT_Service_TTGlyfRec*);
  27. void
  28. tt_driver_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->truetype )
  33. {
  34. TTModulePIC* container = (TTModulePIC*)pic_container->truetype;
  35. if(container->tt_services)
  36. FT_Destroy_Class_tt_services(library, container->tt_services);
  37. container->tt_services = NULL;
  38. FT_FREE( container );
  39. pic_container->truetype = NULL;
  40. }
  41. }
  42. FT_Error
  43. tt_driver_class_pic_init( FT_Library library )
  44. {
  45. FT_PIC_Container* pic_container = &library->pic_container;
  46. FT_Error error = FT_Err_Ok;
  47. TTModulePIC* container;
  48. FT_Memory memory = library->memory;
  49. /* allocate pointer, clear and set global container pointer */
  50. if ( FT_ALLOC ( container, sizeof ( *container ) ) )
  51. return error;
  52. FT_MEM_SET( container, 0, sizeof(*container) );
  53. pic_container->truetype = container;
  54. /* initialize pointer table - this is how the module usually expects this data */
  55. error = FT_Create_Class_tt_services(library, &container->tt_services);
  56. if(error)
  57. goto Exit;
  58. #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
  59. FT_Init_Class_tt_service_gx_multi_masters(&container->tt_service_gx_multi_masters);
  60. #endif
  61. FT_Init_Class_tt_service_truetype_glyf(&container->tt_service_truetype_glyf);
  62. Exit:
  63. if(error)
  64. tt_driver_class_pic_free(library);
  65. return error;
  66. }
  67. #endif /* FT_CONFIG_OPTION_PIC */
  68. /* END */