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