/src/freetype/src/base/ftgxval.c

https://bitbucket.org/cabalistic/ogredeps/ · C · 140 lines · 79 code · 35 blank · 26 comment · 10 complexity · e650006ebae3dd9ea2baca17ef211867 MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftgxval.c */
  4. /* */
  5. /* FreeType API for validating TrueTyepGX/AAT tables (body). */
  6. /* */
  7. /* Copyright 2004, 2005, 2006, 2010 by */
  8. /* Masatake YAMATO, Redhat K.K, */
  9. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  10. /* */
  11. /* This file is part of the FreeType project, and may only be used, */
  12. /* modified, and distributed under the terms of the FreeType project */
  13. /* license, LICENSE.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. /***************************************************************************/
  18. /***************************************************************************/
  19. /* */
  20. /* gxvalid is derived from both gxlayout module and otvalid module. */
  21. /* Development of gxlayout is supported by the Information-technology */
  22. /* Promotion Agency(IPA), Japan. */
  23. /* */
  24. /***************************************************************************/
  25. #include <ft2build.h>
  26. #include FT_INTERNAL_OBJECTS_H
  27. #include FT_SERVICE_GX_VALIDATE_H
  28. /* documentation is in ftgxval.h */
  29. FT_EXPORT_DEF( FT_Error )
  30. FT_TrueTypeGX_Validate( FT_Face face,
  31. FT_UInt validation_flags,
  32. FT_Bytes tables[FT_VALIDATE_GX_LENGTH],
  33. FT_UInt table_length )
  34. {
  35. FT_Service_GXvalidate service;
  36. FT_Error error;
  37. if ( !face )
  38. {
  39. error = FT_Err_Invalid_Face_Handle;
  40. goto Exit;
  41. }
  42. if ( tables == NULL )
  43. {
  44. error = FT_Err_Invalid_Argument;
  45. goto Exit;
  46. }
  47. FT_FACE_FIND_GLOBAL_SERVICE( face, service, GX_VALIDATE );
  48. if ( service )
  49. error = service->validate( face,
  50. validation_flags,
  51. tables,
  52. table_length );
  53. else
  54. error = FT_Err_Unimplemented_Feature;
  55. Exit:
  56. return error;
  57. }
  58. FT_EXPORT_DEF( void )
  59. FT_TrueTypeGX_Free( FT_Face face,
  60. FT_Bytes table )
  61. {
  62. FT_Memory memory;
  63. if ( !face )
  64. return;
  65. memory = FT_FACE_MEMORY( face );
  66. FT_FREE( table );
  67. }
  68. FT_EXPORT_DEF( FT_Error )
  69. FT_ClassicKern_Validate( FT_Face face,
  70. FT_UInt validation_flags,
  71. FT_Bytes *ckern_table )
  72. {
  73. FT_Service_CKERNvalidate service;
  74. FT_Error error;
  75. if ( !face )
  76. {
  77. error = FT_Err_Invalid_Face_Handle;
  78. goto Exit;
  79. }
  80. if ( ckern_table == NULL )
  81. {
  82. error = FT_Err_Invalid_Argument;
  83. goto Exit;
  84. }
  85. FT_FACE_FIND_GLOBAL_SERVICE( face, service, CLASSICKERN_VALIDATE );
  86. if ( service )
  87. error = service->validate( face,
  88. validation_flags,
  89. ckern_table );
  90. else
  91. error = FT_Err_Unimplemented_Feature;
  92. Exit:
  93. return error;
  94. }
  95. FT_EXPORT_DEF( void )
  96. FT_ClassicKern_Free( FT_Face face,
  97. FT_Bytes table )
  98. {
  99. FT_Memory memory;
  100. if ( !face )
  101. return;
  102. memory = FT_FACE_MEMORY( face );
  103. FT_FREE( table );
  104. }
  105. /* END */