/modules/freetype2/src/base/ftotval.c

http://github.com/zpao/v8monkey · C · 89 lines · 53 code · 18 blank · 18 comment · 4 complexity · 2df4a898051da65f6f1fe47c015d5410 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftotval.c */
  4. /* */
  5. /* FreeType API for validating OpenType tables (body). */
  6. /* */
  7. /* Copyright 2004, 2006, 2008, 2010 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 FT_SERVICE_OPENTYPE_VALIDATE_H
  20. #include FT_OPENTYPE_VALIDATE_H
  21. /* documentation is in ftotval.h */
  22. FT_EXPORT_DEF( FT_Error )
  23. FT_OpenType_Validate( FT_Face face,
  24. FT_UInt validation_flags,
  25. FT_Bytes *BASE_table,
  26. FT_Bytes *GDEF_table,
  27. FT_Bytes *GPOS_table,
  28. FT_Bytes *GSUB_table,
  29. FT_Bytes *JSTF_table )
  30. {
  31. FT_Service_OTvalidate service;
  32. FT_Error error;
  33. if ( !face )
  34. {
  35. error = FT_Err_Invalid_Face_Handle;
  36. goto Exit;
  37. }
  38. if ( !( BASE_table &&
  39. GDEF_table &&
  40. GPOS_table &&
  41. GSUB_table &&
  42. JSTF_table ) )
  43. {
  44. error = FT_Err_Invalid_Argument;
  45. goto Exit;
  46. }
  47. FT_FACE_FIND_GLOBAL_SERVICE( face, service, OPENTYPE_VALIDATE );
  48. if ( service )
  49. error = service->validate( face,
  50. validation_flags,
  51. BASE_table,
  52. GDEF_table,
  53. GPOS_table,
  54. GSUB_table,
  55. JSTF_table );
  56. else
  57. error = FT_Err_Unimplemented_Feature;
  58. Exit:
  59. return error;
  60. }
  61. FT_EXPORT_DEF( void )
  62. FT_OpenType_Free( FT_Face face,
  63. FT_Bytes table )
  64. {
  65. FT_Memory memory;
  66. if ( !face )
  67. return;
  68. memory = FT_FACE_MEMORY( face );
  69. FT_FREE( table );
  70. }
  71. /* END */