/src/compiler/android-ndk/jni/freetype/src/cff/cffpic.c

http://ftk.googlecode.com/ · C · 99 lines · 64 code · 13 blank · 22 comment · 7 complexity · 4ab6c2e6374972bc71d3862215366422 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* cffpic.c */
  4. /* */
  5. /* The FreeType position independent code services for cff 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 "cffpic.h"
  21. #ifdef FT_CONFIG_OPTION_PIC
  22. /* forward declaration of PIC init functions from cffdrivr.c */
  23. FT_Error FT_Create_Class_cff_services( FT_Library, FT_ServiceDescRec**);
  24. void FT_Destroy_Class_cff_services( FT_Library, FT_ServiceDescRec*);
  25. void FT_Init_Class_cff_service_ps_info( FT_Library, FT_Service_PsInfoRec*);
  26. void FT_Init_Class_cff_service_glyph_dict( FT_Library, FT_Service_GlyphDictRec*);
  27. void FT_Init_Class_cff_service_ps_name( FT_Library, FT_Service_PsFontNameRec*);
  28. void FT_Init_Class_cff_service_get_cmap_info( FT_Library, FT_Service_TTCMapsRec*);
  29. void FT_Init_Class_cff_service_cid_info( FT_Library, FT_Service_CIDRec*);
  30. /* forward declaration of PIC init functions from cffparse.c */
  31. FT_Error FT_Create_Class_cff_field_handlers( FT_Library, CFF_Field_Handler**);
  32. void FT_Destroy_Class_cff_field_handlers( FT_Library, CFF_Field_Handler*);
  33. /* forward declaration of PIC init functions from cffcmap.c */
  34. void FT_Init_Class_cff_cmap_encoding_class_rec( FT_Library, FT_CMap_ClassRec*);
  35. void FT_Init_Class_cff_cmap_unicode_class_rec( FT_Library, FT_CMap_ClassRec*);
  36. void
  37. cff_driver_class_pic_free( FT_Library library )
  38. {
  39. FT_PIC_Container* pic_container = &library->pic_container;
  40. FT_Memory memory = library->memory;
  41. if ( pic_container->cff )
  42. {
  43. CffModulePIC* container = (CffModulePIC*)pic_container->cff;
  44. if(container->cff_services)
  45. FT_Destroy_Class_cff_services(library, container->cff_services);
  46. container->cff_services = NULL;
  47. if(container->cff_field_handlers)
  48. FT_Destroy_Class_cff_field_handlers(library, container->cff_field_handlers);
  49. container->cff_field_handlers = NULL;
  50. FT_FREE( container );
  51. pic_container->cff = NULL;
  52. }
  53. }
  54. FT_Error
  55. cff_driver_class_pic_init( FT_Library library )
  56. {
  57. FT_PIC_Container* pic_container = &library->pic_container;
  58. FT_Error error = FT_Err_Ok;
  59. CffModulePIC* container;
  60. FT_Memory memory = library->memory;
  61. /* allocate pointer, clear and set global container pointer */
  62. if ( FT_ALLOC ( container, sizeof ( *container ) ) )
  63. return error;
  64. FT_MEM_SET( container, 0, sizeof(*container) );
  65. pic_container->cff = container;
  66. /* initialize pointer table - this is how the module usually expects this data */
  67. error = FT_Create_Class_cff_services(library, &container->cff_services);
  68. if(error)
  69. goto Exit;
  70. error = FT_Create_Class_cff_field_handlers(library, &container->cff_field_handlers);
  71. if(error)
  72. goto Exit;
  73. FT_Init_Class_cff_service_ps_info(library, &container->cff_service_ps_info);
  74. FT_Init_Class_cff_service_glyph_dict(library, &container->cff_service_glyph_dict);
  75. FT_Init_Class_cff_service_ps_name(library, &container->cff_service_ps_name);
  76. FT_Init_Class_cff_service_get_cmap_info(library, &container->cff_service_get_cmap_info);
  77. FT_Init_Class_cff_service_cid_info(library, &container->cff_service_cid_info);
  78. FT_Init_Class_cff_cmap_encoding_class_rec(library, &container->cff_cmap_encoding_class_rec);
  79. FT_Init_Class_cff_cmap_unicode_class_rec(library, &container->cff_cmap_unicode_class_rec);
  80. Exit:
  81. if(error)
  82. cff_driver_class_pic_free(library);
  83. return error;
  84. }
  85. #endif /* FT_CONFIG_OPTION_PIC */
  86. /* END */