home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: SysTools / SysTools.zip / ft-beta.zip / freetype / lib / ttload.h < prev    next >
C/C++ Source or Header  |  1997-10-06  |  7KB  |  193 lines

  1. /*******************************************************************
  2.  *
  3.  *  ttload.h                                                    1.0
  4.  *
  5.  *    TrueType Tables Loader.                          
  6.  *
  7.  *  Copyright 1996, 1997 by
  8.  *  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. #ifndef TTLOAD_H
  20. #define TTLOAD_H
  21.  
  22. #include "ttcommon.h"
  23.  
  24.   #ifdef __cplusplus
  25.   extern "C" {
  26.   #endif
  27.  
  28.   Int  LookUp_TrueType_Table( PFace  face,
  29.                               Long   tag  );
  30.  
  31.   TT_Error  Load_TrueType_Directory        ( PFace  face, 
  32.                                              int    faceIndex );
  33.  
  34.   TT_Error  Load_TrueType_MaxProfile       ( PFace  face );
  35.   TT_Error  Load_TrueType_Gasp             ( PFace  face );
  36.   TT_Error  Load_TrueType_Header           ( PFace  face );
  37.   TT_Error  Load_TrueType_Horizontal_Header( PFace  face );
  38.   TT_Error  Load_TrueType_Locations        ( PFace  face );
  39.   TT_Error  Load_TrueType_Names            ( PFace  face );
  40.   TT_Error  Load_TrueType_CVT              ( PFace  face );
  41.   TT_Error  Load_TrueType_CMap             ( PFace  face );
  42.   TT_Error  Load_TrueType_HMTX             ( PFace  face );
  43.   TT_Error  Load_TrueType_Programs         ( PFace  face );
  44.   TT_Error  Load_TrueType_OS2              ( PFace  face );
  45.   TT_Error  Load_TrueType_PostScript       ( PFace  face );
  46.  
  47.   TT_Error  Free_TrueType_Names( PFace  face );
  48.  
  49.   /* The following macros are defined to simplify the writing of */
  50.   /* the various table and glyph loaders.                        */
  51.  
  52.   /* For examples, see the code in ttload.c, ttgload.c etc..     */
  53.  
  54.   #define USE_Stream( original, duplicate ) \
  55.             ( error = TT_Use_Stream( original, &duplicate ) )
  56.  
  57.   #define DONE_Stream( _stream ) \
  58.             TT_Done_Stream(&_stream)
  59.  
  60.   /* Define a file frame - use it only when needed */
  61.   #define DEFINE_A_FRAME   TFileFrame  frame = Null_FileFrame
  62.  
  63.   /* Define a stream - use it only when needed */
  64.   #define DEFINE_A_STREAM  TT_Stream   stream
  65.  
  66. #ifdef TT_CONFIG_REENTRANT  /* re-entrant implementation */
  67.  
  68.   /* The following macros are used to define the necessary local */
  69.   /* variables used to access streams and frames                 */
  70.  
  71.   /* Define stream locals with frame */
  72.   #define DEFINE_STREAM_LOCALS  \
  73.             TT_Error    error;  \
  74.             DEFINE_A_STREAM;      \
  75.             DEFINE_A_FRAME
  76.  
  77.   /* Define stream locals without frame */
  78.   #define DEFINE_STREAM_LOCALS_WO_FRAME  \
  79.             TT_Error    error;  \
  80.             DEFINE_A_STREAM
  81.  
  82.   /* Define locals with a predefined stream in reentrant mode - see ttload.c */
  83.   #define DEFINE_LOAD_LOCALS(STREAM)  \
  84.             TT_Error      error;  \
  85.             DEFINE_A_STREAM = (STREAM); \
  86.             DEFINE_A_FRAME
  87.  
  88.   /* Define locals without frame with a predefined stream - see ttload.c */
  89.   #define DEFINE_LOAD_LOCALS_WO_FRAME(STREAM) \
  90.             TT_Error      error;  \
  91.             DEFINE_A_STREAM = (STREAM)
  92.  
  93.   /* Define all locals necessary to access a font file */
  94.   #define DEFINE_ALL_LOCALS \
  95.             TT_Error     error;  \
  96.             DEFINE_A_STREAM;     \
  97.             DEFINE_A_FRAME
  98.  
  99.   #define ACCESS_Frame( _size_ ) \
  100.             (error = TT_Access_Frame( stream, &frame, _size_ ))
  101.   
  102.   #define CHECK_ACCESS_Frame( _size_ ) \
  103.             (error = TT_Check_And_Access_Frame( stream, &frame, _size_ ))
  104.  
  105.   #define FORGET_Frame() \
  106.             (error = TT_Forget_Frame( &frame ))
  107.   
  108.   #define GET_Byte()    Get_Byte  ( &frame )
  109.   #define GET_Char()    Get_Char  ( &frame )
  110.   #define GET_UShort()  Get_UShort( &frame )
  111.   #define GET_Short()   Get_Short ( &frame )
  112.   #define GET_Long()    Get_Long  ( &frame )
  113.   #define GET_ULong()   Get_ULong ( &frame )
  114.   #define GET_Tag4()    Get_Long  ( &frame )
  115.   
  116.   #define FILE_Pos()              \
  117.             (error = TT_File_Pos ( stream ))
  118.  
  119.   #define FILE_Seek( _position_ ) \
  120.             (error = TT_Seek_File( stream, _position_ ))
  121.  
  122.   #define FILE_Skip( _distance_ ) \
  123.             (error = TT_Skip_File( stream, _distance_ ))
  124.   
  125.   #define FILE_Read( buffer, count ) \
  126.             (error = TT_Read_File ( stream, buffer, count ))
  127.  
  128.   #define FILE_Read_At( pos, buffer, count ) \
  129.             (error = TT_Read_At_File( stream, pos, buffer, count ))
  130.   
  131. #else   /* thread-safe implementation */
  132.  
  133.   /* Define stream locals with frame - nothing in thread-safe mode */
  134.   #define DEFINE_STREAM_LOCALS  \
  135.             TT_Error    error
  136.  
  137.   /* Define stream locals without frame - nothing in thread-safe mode */
  138.   #define DEFINE_STREAM_LOCALS_WO_FRAME  \
  139.             TT_Error    error
  140.  
  141.   /* Define locals with a predefined stream in reentrant mode - see ttload.c */
  142.   #define DEFINE_LOAD_LOCALS(STREAM)  \
  143.             TT_Error      error
  144.  
  145.   /* Define locals without frame with a predefined stream - see ttload.c */
  146.   #define DEFINE_LOAD_LOCALS_WO_FRAME(STREAM) \
  147.             TT_Error      error
  148.  
  149.   /* Define all locals necessary to access a font file */
  150.   #define DEFINE_ALL_LOCALS  \
  151.             TT_Error      error; \
  152.             DEFINE_A_STREAM
  153.  
  154.   #define ACCESS_Frame( _size_ ) \
  155.             (error = TT_Access_Frame( _size_ ))
  156.   
  157.   #define CHECK_ACCESS_Frame( _size_ ) \
  158.             (error = TT_Check_And_Access_Frame( _size_ ))
  159.  
  160.   #define FORGET_Frame() \
  161.             (error = TT_Forget_Frame())
  162.   
  163.   #define GET_Byte()    Get_Byte  ()
  164.   #define GET_Char()    Get_Char  ()
  165.   #define GET_UShort()  Get_UShort()
  166.   #define GET_Short()   Get_Short ()
  167.   #define GET_Long()    Get_Long  ()
  168.   #define GET_ULong()   Get_ULong ()
  169.   #define GET_Tag4()    Get_Long  ()
  170.   
  171.   #define FILE_Pos()              \
  172.             (error = TT_File_Pos ())
  173.  
  174.   #define FILE_Seek( _position_ ) \
  175.             (error = TT_Seek_File( _position_ ))
  176.  
  177.   #define FILE_Skip( _distance_ ) \
  178.             (error = TT_Skip_File( _distance_ ))
  179.   
  180.   #define FILE_Read( buffer, count ) \
  181.             (error = TT_Read_File ( buffer, count ))
  182.  
  183.   #define FILE_Read_At( pos, buffer, count ) \
  184.             (error = TT_Read_At_File( pos, buffer, count ))
  185.   
  186. #endif /* REENTRANT */
  187.  
  188.   #ifdef __cplusplus
  189.   }
  190.   #endif
  191.  
  192. #endif /* TTLOAD_H */
  193.