/modules/freetype2/include/freetype/internal/ftrfork.h

http://github.com/zpao/v8monkey · C Header · 196 lines · 34 code · 24 blank · 138 comment · 0 complexity · 08ad3753606088b17350dced3b4babae MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftrfork.h */
  4. /* */
  5. /* Embedded resource forks accessor (specification). */
  6. /* */
  7. /* Copyright 2004, 2006, 2007 by */
  8. /* Masatake YAMATO and Redhat K.K. */
  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. /* Development of the code in this file is support of */
  19. /* Information-technology Promotion Agency, Japan. */
  20. /***************************************************************************/
  21. #ifndef __FTRFORK_H__
  22. #define __FTRFORK_H__
  23. #include <ft2build.h>
  24. #include FT_INTERNAL_OBJECTS_H
  25. FT_BEGIN_HEADER
  26. /* Number of guessing rules supported in `FT_Raccess_Guess'. */
  27. /* Don't forget to increment the number if you add a new guessing rule. */
  28. #define FT_RACCESS_N_RULES 9
  29. /* A structure to describe a reference in a resource by its resource ID */
  30. /* and internal offset. The `POST' resource expects to be concatenated */
  31. /* by the order of resource IDs instead of its appearance in the file. */
  32. typedef struct FT_RFork_Ref_
  33. {
  34. FT_UShort res_id;
  35. FT_ULong offset;
  36. } FT_RFork_Ref;
  37. /*************************************************************************/
  38. /* */
  39. /* <Function> */
  40. /* FT_Raccess_Guess */
  41. /* */
  42. /* <Description> */
  43. /* Guess a file name and offset where the actual resource fork is */
  44. /* stored. The macro FT_RACCESS_N_RULES holds the number of */
  45. /* guessing rules; the guessed result for the Nth rule is */
  46. /* represented as a triplet: a new file name (new_names[N]), a file */
  47. /* offset (offsets[N]), and an error code (errors[N]). */
  48. /* */
  49. /* <Input> */
  50. /* library :: */
  51. /* A FreeType library instance. */
  52. /* */
  53. /* stream :: */
  54. /* A file stream containing the resource fork. */
  55. /* */
  56. /* base_name :: */
  57. /* The (base) file name of the resource fork used for some */
  58. /* guessing rules. */
  59. /* */
  60. /* <Output> */
  61. /* new_names :: */
  62. /* An array of guessed file names in which the resource forks may */
  63. /* exist. If `new_names[N]' is NULL, the guessed file name is */
  64. /* equal to `base_name'. */
  65. /* */
  66. /* offsets :: */
  67. /* An array of guessed file offsets. `offsets[N]' holds the file */
  68. /* offset of the possible start of the resource fork in file */
  69. /* `new_names[N]'. */
  70. /* */
  71. /* errors :: */
  72. /* An array of FreeType error codes. `errors[N]' is the error */
  73. /* code of Nth guessing rule function. If `errors[N]' is not */
  74. /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */
  75. /* */
  76. FT_BASE( void )
  77. FT_Raccess_Guess( FT_Library library,
  78. FT_Stream stream,
  79. char* base_name,
  80. char** new_names,
  81. FT_Long* offsets,
  82. FT_Error* errors );
  83. /*************************************************************************/
  84. /* */
  85. /* <Function> */
  86. /* FT_Raccess_Get_HeaderInfo */
  87. /* */
  88. /* <Description> */
  89. /* Get the information from the header of resource fork. The */
  90. /* information includes the file offset where the resource map */
  91. /* starts, and the file offset where the resource data starts. */
  92. /* `FT_Raccess_Get_DataOffsets' requires these two data. */
  93. /* */
  94. /* <Input> */
  95. /* library :: */
  96. /* A FreeType library instance. */
  97. /* */
  98. /* stream :: */
  99. /* A file stream containing the resource fork. */
  100. /* */
  101. /* rfork_offset :: */
  102. /* The file offset where the resource fork starts. */
  103. /* */
  104. /* <Output> */
  105. /* map_offset :: */
  106. /* The file offset where the resource map starts. */
  107. /* */
  108. /* rdata_pos :: */
  109. /* The file offset where the resource data starts. */
  110. /* */
  111. /* <Return> */
  112. /* FreeType error code. FT_Err_Ok means success. */
  113. /* */
  114. FT_BASE( FT_Error )
  115. FT_Raccess_Get_HeaderInfo( FT_Library library,
  116. FT_Stream stream,
  117. FT_Long rfork_offset,
  118. FT_Long *map_offset,
  119. FT_Long *rdata_pos );
  120. /*************************************************************************/
  121. /* */
  122. /* <Function> */
  123. /* FT_Raccess_Get_DataOffsets */
  124. /* */
  125. /* <Description> */
  126. /* Get the data offsets for a tag in a resource fork. Offsets are */
  127. /* stored in an array because, in some cases, resources in a resource */
  128. /* fork have the same tag. */
  129. /* */
  130. /* <Input> */
  131. /* library :: */
  132. /* A FreeType library instance. */
  133. /* */
  134. /* stream :: */
  135. /* A file stream containing the resource fork. */
  136. /* */
  137. /* map_offset :: */
  138. /* The file offset where the resource map starts. */
  139. /* */
  140. /* rdata_pos :: */
  141. /* The file offset where the resource data starts. */
  142. /* */
  143. /* tag :: */
  144. /* The resource tag. */
  145. /* */
  146. /* <Output> */
  147. /* offsets :: */
  148. /* The stream offsets for the resource data specified by `tag'. */
  149. /* This array is allocated by the function, so you have to call */
  150. /* @ft_mem_free after use. */
  151. /* */
  152. /* count :: */
  153. /* The length of offsets array. */
  154. /* */
  155. /* <Return> */
  156. /* FreeType error code. FT_Err_Ok means success. */
  157. /* */
  158. /* <Note> */
  159. /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */
  160. /* value for `map_offset' and `rdata_pos'. */
  161. /* */
  162. FT_BASE( FT_Error )
  163. FT_Raccess_Get_DataOffsets( FT_Library library,
  164. FT_Stream stream,
  165. FT_Long map_offset,
  166. FT_Long rdata_pos,
  167. FT_Long tag,
  168. FT_Long **offsets,
  169. FT_Long *count );
  170. FT_END_HEADER
  171. #endif /* __FTRFORK_H__ */
  172. /* END */