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