Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

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