ftotval.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /***************************************************************************/
  2. /* */
  3. /* ftotval.h */
  4. /* */
  5. /* FreeType API for validating OpenType tables (specification). */
  6. /* */
  7. /* Copyright 2004, 2005, 2006 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. /***************************************************************************/
  18. /* */
  19. /* */
  20. /* Warning: This module might be moved to a different library in the */
  21. /* future to avoid a tight dependency between FreeType and the */
  22. /* OpenType specification. */
  23. /* */
  24. /* */
  25. /***************************************************************************/
  26. #ifndef __FTOTVAL_H__
  27. #define __FTOTVAL_H__
  28. #include <ft2build.h>
  29. #include FT_FREETYPE_H
  30. #ifdef FREETYPE_H
  31. #error "freetype.h of FreeType 1 has been loaded!"
  32. #error "Please fix the directory search order for header files"
  33. #error "so that freetype.h of FreeType 2 is found first."
  34. #endif
  35. FT_BEGIN_HEADER
  36. /*************************************************************************/
  37. /* */
  38. /* <Section> */
  39. /* ot_validation */
  40. /* */
  41. /* <Title> */
  42. /* OpenType Validation */
  43. /* */
  44. /* <Abstract> */
  45. /* An API to validate OpenType tables. */
  46. /* */
  47. /* <Description> */
  48. /* This section contains the declaration of functions to validate */
  49. /* some OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF). */
  50. /* */
  51. /*************************************************************************/
  52. /**********************************************************************
  53. *
  54. * @enum:
  55. * FT_VALIDATE_OTXXX
  56. *
  57. * @description:
  58. * A list of bit-field constants used with @FT_OpenType_Validate to
  59. * indicate which OpenType tables should be validated.
  60. *
  61. * @values:
  62. * FT_VALIDATE_BASE ::
  63. * Validate BASE table.
  64. *
  65. * FT_VALIDATE_GDEF ::
  66. * Validate GDEF table.
  67. *
  68. * FT_VALIDATE_GPOS ::
  69. * Validate GPOS table.
  70. *
  71. * FT_VALIDATE_GSUB ::
  72. * Validate GSUB table.
  73. *
  74. * FT_VALIDATE_JSTF ::
  75. * Validate JSTF table.
  76. *
  77. * FT_VALIDATE_OT ::
  78. * Validate all OpenType tables (BASE, GDEF, GPOS, GSUB, JSTF).
  79. *
  80. */
  81. #define FT_VALIDATE_BASE 0x0100
  82. #define FT_VALIDATE_GDEF 0x0200
  83. #define FT_VALIDATE_GPOS 0x0400
  84. #define FT_VALIDATE_GSUB 0x0800
  85. #define FT_VALIDATE_JSTF 0x1000
  86. #define FT_VALIDATE_OT FT_VALIDATE_BASE | \
  87. FT_VALIDATE_GDEF | \
  88. FT_VALIDATE_GPOS | \
  89. FT_VALIDATE_GSUB | \
  90. FT_VALIDATE_JSTF
  91. /* */
  92. /**********************************************************************
  93. *
  94. * @function:
  95. * FT_OpenType_Validate
  96. *
  97. * @description:
  98. * Validate various OpenType tables to assure that all offsets and
  99. * indices are valid. The idea is that a higher-level library which
  100. * actually does the text layout can access those tables without
  101. * error checking (which can be quite time consuming).
  102. *
  103. * @input:
  104. * face ::
  105. * A handle to the input face.
  106. *
  107. * validation_flags ::
  108. * A bit field which specifies the tables to be validated. See
  109. * @FT_VALIDATE_OTXXX for possible values.
  110. *
  111. * @output:
  112. * BASE_table ::
  113. * A pointer to the BASE table.
  114. *
  115. * GDEF_table ::
  116. * A pointer to the GDEF table.
  117. *
  118. * GPOS_table ::
  119. * A pointer to the GPOS table.
  120. *
  121. * GSUB_table ::
  122. * A pointer to the GSUB table.
  123. *
  124. * JSTF_table ::
  125. * A pointer to the JSTF table.
  126. *
  127. * @return:
  128. * FreeType error code. 0 means success.
  129. *
  130. * @note:
  131. * This function only works with OpenType fonts, returning an error
  132. * otherwise.
  133. *
  134. * After use, the application should deallocate the five tables with
  135. * @FT_OpenType_Free. A NULL value indicates that the table either
  136. * doesn't exist in the font, or the application hasn't asked for
  137. * validation.
  138. */
  139. FT_EXPORT( FT_Error )
  140. FT_OpenType_Validate( FT_Face face,
  141. FT_UInt validation_flags,
  142. FT_Bytes *BASE_table,
  143. FT_Bytes *GDEF_table,
  144. FT_Bytes *GPOS_table,
  145. FT_Bytes *GSUB_table,
  146. FT_Bytes *JSTF_table );
  147. /* */
  148. /**********************************************************************
  149. *
  150. * @function:
  151. * FT_OpenType_Free
  152. *
  153. * @description:
  154. * Free the buffer allocated by OpenType validator.
  155. *
  156. * @input:
  157. * face ::
  158. * A handle to the input face.
  159. *
  160. * table ::
  161. * The pointer to the buffer that is allocated by
  162. * @FT_OpenType_Validate.
  163. *
  164. * @note:
  165. * This function must be used to free the buffer allocated by
  166. * @FT_OpenType_Validate only.
  167. */
  168. FT_EXPORT( void )
  169. FT_OpenType_Free( FT_Face face,
  170. FT_Bytes table );
  171. /* */
  172. FT_END_HEADER
  173. #endif /* __FTOTVAL_H__ */
  174. /* END */