ftmac.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /****************************************************************************
  2. *
  3. * ftmac.h
  4. *
  5. * Additional Mac-specific API.
  6. *
  7. * Copyright (C) 1996-2023 by
  8. * Just van Rossum, 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. * NOTE: Include this file after `FT_FREETYPE_H` and after any
  20. * Mac-specific headers (because this header uses Mac types such as
  21. * 'Handle', 'FSSpec', 'FSRef', etc.)
  22. *
  23. */
  24. #ifndef FTMAC_H_
  25. #define FTMAC_H_
  26. FT_BEGIN_HEADER
  27. /* gcc-3.1 and later can warn about functions tagged as deprecated */
  28. #ifndef FT_DEPRECATED_ATTRIBUTE
  29. #if defined( __GNUC__ ) && \
  30. ( ( __GNUC__ >= 4 ) || \
  31. ( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )
  32. #define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))
  33. #else
  34. #define FT_DEPRECATED_ATTRIBUTE
  35. #endif
  36. #endif
  37. /**************************************************************************
  38. *
  39. * @section:
  40. * mac_specific
  41. *
  42. * @title:
  43. * Mac Specific Interface
  44. *
  45. * @abstract:
  46. * Only available on the Macintosh.
  47. *
  48. * @description:
  49. * The following definitions are only available if FreeType is compiled
  50. * on a Macintosh.
  51. *
  52. */
  53. /**************************************************************************
  54. *
  55. * @function:
  56. * FT_New_Face_From_FOND
  57. *
  58. * @description:
  59. * Create a new face object from a FOND resource.
  60. *
  61. * @inout:
  62. * library ::
  63. * A handle to the library resource.
  64. *
  65. * @input:
  66. * fond ::
  67. * A FOND resource.
  68. *
  69. * face_index ::
  70. * Only supported for the -1 'sanity check' special case.
  71. *
  72. * @output:
  73. * aface ::
  74. * A handle to a new face object.
  75. *
  76. * @return:
  77. * FreeType error code. 0~means success.
  78. *
  79. * @example:
  80. * This function can be used to create @FT_Face objects from fonts that
  81. * are installed in the system as follows.
  82. *
  83. * ```
  84. * fond = GetResource( 'FOND', fontName );
  85. * error = FT_New_Face_From_FOND( library, fond, 0, &face );
  86. * ```
  87. */
  88. FT_EXPORT( FT_Error )
  89. FT_New_Face_From_FOND( FT_Library library,
  90. Handle fond,
  91. FT_Long face_index,
  92. FT_Face *aface )
  93. FT_DEPRECATED_ATTRIBUTE;
  94. /**************************************************************************
  95. *
  96. * @function:
  97. * FT_GetFile_From_Mac_Name
  98. *
  99. * @description:
  100. * Return an FSSpec for the disk file containing the named font.
  101. *
  102. * @input:
  103. * fontName ::
  104. * Mac OS name of the font (e.g., Times New Roman Bold).
  105. *
  106. * @output:
  107. * pathSpec ::
  108. * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.
  109. *
  110. * face_index ::
  111. * Index of the face. For passing to @FT_New_Face_From_FSSpec.
  112. *
  113. * @return:
  114. * FreeType error code. 0~means success.
  115. */
  116. FT_EXPORT( FT_Error )
  117. FT_GetFile_From_Mac_Name( const char* fontName,
  118. FSSpec* pathSpec,
  119. FT_Long* face_index )
  120. FT_DEPRECATED_ATTRIBUTE;
  121. /**************************************************************************
  122. *
  123. * @function:
  124. * FT_GetFile_From_Mac_ATS_Name
  125. *
  126. * @description:
  127. * Return an FSSpec for the disk file containing the named font.
  128. *
  129. * @input:
  130. * fontName ::
  131. * Mac OS name of the font in ATS framework.
  132. *
  133. * @output:
  134. * pathSpec ::
  135. * FSSpec to the file. For passing to @FT_New_Face_From_FSSpec.
  136. *
  137. * face_index ::
  138. * Index of the face. For passing to @FT_New_Face_From_FSSpec.
  139. *
  140. * @return:
  141. * FreeType error code. 0~means success.
  142. */
  143. FT_EXPORT( FT_Error )
  144. FT_GetFile_From_Mac_ATS_Name( const char* fontName,
  145. FSSpec* pathSpec,
  146. FT_Long* face_index )
  147. FT_DEPRECATED_ATTRIBUTE;
  148. /**************************************************************************
  149. *
  150. * @function:
  151. * FT_GetFilePath_From_Mac_ATS_Name
  152. *
  153. * @description:
  154. * Return a pathname of the disk file and face index for given font name
  155. * that is handled by ATS framework.
  156. *
  157. * @input:
  158. * fontName ::
  159. * Mac OS name of the font in ATS framework.
  160. *
  161. * @output:
  162. * path ::
  163. * Buffer to store pathname of the file. For passing to @FT_New_Face.
  164. * The client must allocate this buffer before calling this function.
  165. *
  166. * maxPathSize ::
  167. * Lengths of the buffer `path` that client allocated.
  168. *
  169. * face_index ::
  170. * Index of the face. For passing to @FT_New_Face.
  171. *
  172. * @return:
  173. * FreeType error code. 0~means success.
  174. */
  175. FT_EXPORT( FT_Error )
  176. FT_GetFilePath_From_Mac_ATS_Name( const char* fontName,
  177. UInt8* path,
  178. UInt32 maxPathSize,
  179. FT_Long* face_index )
  180. FT_DEPRECATED_ATTRIBUTE;
  181. /**************************************************************************
  182. *
  183. * @function:
  184. * FT_New_Face_From_FSSpec
  185. *
  186. * @description:
  187. * Create a new face object from a given resource and typeface index
  188. * using an FSSpec to the font file.
  189. *
  190. * @inout:
  191. * library ::
  192. * A handle to the library resource.
  193. *
  194. * @input:
  195. * spec ::
  196. * FSSpec to the font file.
  197. *
  198. * face_index ::
  199. * The index of the face within the resource. The first face has
  200. * index~0.
  201. * @output:
  202. * aface ::
  203. * A handle to a new face object.
  204. *
  205. * @return:
  206. * FreeType error code. 0~means success.
  207. *
  208. * @note:
  209. * @FT_New_Face_From_FSSpec is identical to @FT_New_Face except it
  210. * accepts an FSSpec instead of a path.
  211. */
  212. FT_EXPORT( FT_Error )
  213. FT_New_Face_From_FSSpec( FT_Library library,
  214. const FSSpec *spec,
  215. FT_Long face_index,
  216. FT_Face *aface )
  217. FT_DEPRECATED_ATTRIBUTE;
  218. /**************************************************************************
  219. *
  220. * @function:
  221. * FT_New_Face_From_FSRef
  222. *
  223. * @description:
  224. * Create a new face object from a given resource and typeface index
  225. * using an FSRef to the font file.
  226. *
  227. * @inout:
  228. * library ::
  229. * A handle to the library resource.
  230. *
  231. * @input:
  232. * spec ::
  233. * FSRef to the font file.
  234. *
  235. * face_index ::
  236. * The index of the face within the resource. The first face has
  237. * index~0.
  238. * @output:
  239. * aface ::
  240. * A handle to a new face object.
  241. *
  242. * @return:
  243. * FreeType error code. 0~means success.
  244. *
  245. * @note:
  246. * @FT_New_Face_From_FSRef is identical to @FT_New_Face except it accepts
  247. * an FSRef instead of a path.
  248. */
  249. FT_EXPORT( FT_Error )
  250. FT_New_Face_From_FSRef( FT_Library library,
  251. const FSRef *ref,
  252. FT_Long face_index,
  253. FT_Face *aface )
  254. FT_DEPRECATED_ATTRIBUTE;
  255. /* */
  256. FT_END_HEADER
  257. #endif /* FTMAC_H_ */
  258. /* END */