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