1 /****************************************************************************
   2  *
   3  * psobjs.h
   4  *
   5  *   Auxiliary functions for PostScript fonts (specification).
   6  *
   7  * Copyright (C) 1996-2019 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 PSOBJS_H_
  20 #define PSOBJS_H_
  21 
  22 
  23 #include <ft2build.h>
  24 #include FT_INTERNAL_POSTSCRIPT_AUX_H
  25 #include FT_INTERNAL_CFF_OBJECTS_TYPES_H
  26 
  27 
  28 FT_BEGIN_HEADER
  29 
  30 
  31   /*************************************************************************/
  32   /*************************************************************************/
  33   /*****                                                               *****/
  34   /*****                             T1_TABLE                          *****/
  35   /*****                                                               *****/
  36   /*************************************************************************/
  37   /*************************************************************************/
  38 
  39 
  40   FT_CALLBACK_TABLE
  41   const PS_Table_FuncsRec    ps_table_funcs;
  42 
  43   FT_CALLBACK_TABLE
  44   const PS_Parser_FuncsRec   ps_parser_funcs;
  45 
  46   FT_CALLBACK_TABLE
  47   const T1_Builder_FuncsRec  t1_builder_funcs;
  48 
  49 
  50   FT_LOCAL( FT_Error )
  51   ps_table_new( PS_Table   table,
  52                 FT_Int     count,
  53                 FT_Memory  memory );
  54 
  55   FT_LOCAL( FT_Error )
  56   ps_table_add( PS_Table     table,
  57                 FT_Int       idx,
  58                 const void*  object,
  59                 FT_UInt      length );
  60 
  61   FT_LOCAL( void )
  62   ps_table_done( PS_Table  table );
  63 
  64 
  65   FT_LOCAL( void )
  66   ps_table_release( PS_Table  table );
  67 
  68 
  69   /*************************************************************************/
  70   /*************************************************************************/
  71   /*****                                                               *****/
  72   /*****                            T1 PARSER                          *****/
  73   /*****                                                               *****/
  74   /*************************************************************************/
  75   /*************************************************************************/
  76 
  77 
  78   FT_LOCAL( void )
  79   ps_parser_skip_spaces( PS_Parser  parser );
  80 
  81   FT_LOCAL( void )
  82   ps_parser_skip_PS_token( PS_Parser  parser );
  83 
  84   FT_LOCAL( void )
  85   ps_parser_to_token( PS_Parser  parser,
  86                       T1_Token   token );
  87 
  88   FT_LOCAL( void )
  89   ps_parser_to_token_array( PS_Parser  parser,
  90                             T1_Token   tokens,
  91                             FT_UInt    max_tokens,
  92                             FT_Int*    pnum_tokens );
  93 
  94   FT_LOCAL( FT_Error )
  95   ps_parser_load_field( PS_Parser       parser,
  96                         const T1_Field  field,
  97                         void**          objects,
  98                         FT_UInt         max_objects,
  99                         FT_ULong*       pflags );
 100 
 101   FT_LOCAL( FT_Error )
 102   ps_parser_load_field_table( PS_Parser       parser,
 103                               const T1_Field  field,
 104                               void**          objects,
 105                               FT_UInt         max_objects,
 106                               FT_ULong*       pflags );
 107 
 108   FT_LOCAL( FT_Long )
 109   ps_parser_to_int( PS_Parser  parser );
 110 
 111 
 112   FT_LOCAL( FT_Error )
 113   ps_parser_to_bytes( PS_Parser  parser,
 114                       FT_Byte*   bytes,
 115                       FT_Offset  max_bytes,
 116                       FT_ULong*  pnum_bytes,
 117                       FT_Bool    delimiters );
 118 
 119 
 120   FT_LOCAL( FT_Fixed )
 121   ps_parser_to_fixed( PS_Parser  parser,
 122                       FT_Int     power_ten );
 123 
 124 
 125   FT_LOCAL( FT_Int )
 126   ps_parser_to_coord_array( PS_Parser  parser,
 127                             FT_Int     max_coords,
 128                             FT_Short*  coords );
 129 
 130   FT_LOCAL( FT_Int )
 131   ps_parser_to_fixed_array( PS_Parser  parser,
 132                             FT_Int     max_values,
 133                             FT_Fixed*  values,
 134                             FT_Int     power_ten );
 135 
 136 
 137   FT_LOCAL( void )
 138   ps_parser_init( PS_Parser  parser,
 139                   FT_Byte*   base,
 140                   FT_Byte*   limit,
 141                   FT_Memory  memory );
 142 
 143   FT_LOCAL( void )
 144   ps_parser_done( PS_Parser  parser );
 145 
 146 
 147   /*************************************************************************/
 148   /*************************************************************************/
 149   /*****                                                               *****/
 150   /*****                            T1 BUILDER                         *****/
 151   /*****                                                               *****/
 152   /*************************************************************************/
 153   /*************************************************************************/
 154 
 155   FT_LOCAL( void )
 156   t1_builder_init( T1_Builder    builder,
 157                    FT_Face       face,
 158                    FT_Size       size,
 159                    FT_GlyphSlot  glyph,
 160                    FT_Bool       hinting );
 161 
 162   FT_LOCAL( void )
 163   t1_builder_done( T1_Builder  builder );
 164 
 165   FT_LOCAL( FT_Error )
 166   t1_builder_check_points( T1_Builder  builder,
 167                            FT_Int      count );
 168 
 169   FT_LOCAL( void )
 170   t1_builder_add_point( T1_Builder  builder,
 171                         FT_Pos      x,
 172                         FT_Pos      y,
 173                         FT_Byte     flag );
 174 
 175   FT_LOCAL( FT_Error )
 176   t1_builder_add_point1( T1_Builder  builder,
 177                          FT_Pos      x,
 178                          FT_Pos      y );
 179 
 180   FT_LOCAL( FT_Error )
 181   t1_builder_add_contour( T1_Builder  builder );
 182 
 183 
 184   FT_LOCAL( FT_Error )
 185   t1_builder_start_point( T1_Builder  builder,
 186                           FT_Pos      x,
 187                           FT_Pos      y );
 188 
 189 
 190   FT_LOCAL( void )
 191   t1_builder_close_contour( T1_Builder  builder );
 192 
 193 
 194   /*************************************************************************/
 195   /*************************************************************************/
 196   /*****                                                               *****/
 197   /*****                           CFF BUILDER                         *****/
 198   /*****                                                               *****/
 199   /*************************************************************************/
 200   /*************************************************************************/
 201 
 202   FT_LOCAL( void )
 203   cff_builder_init( CFF_Builder*   builder,
 204                     TT_Face        face,
 205                     CFF_Size       size,
 206                     CFF_GlyphSlot  glyph,
 207                     FT_Bool        hinting );
 208 
 209   FT_LOCAL( void )
 210   cff_builder_done( CFF_Builder*  builder );
 211 
 212   FT_LOCAL( FT_Error )
 213   cff_check_points( CFF_Builder*  builder,
 214                     FT_Int        count );
 215 
 216   FT_LOCAL( void )
 217   cff_builder_add_point( CFF_Builder*  builder,
 218                          FT_Pos        x,
 219                          FT_Pos        y,
 220                          FT_Byte       flag );
 221   FT_LOCAL( FT_Error )
 222   cff_builder_add_point1( CFF_Builder*  builder,
 223                           FT_Pos        x,
 224                           FT_Pos        y );
 225   FT_LOCAL( FT_Error )
 226   cff_builder_start_point( CFF_Builder*  builder,
 227                            FT_Pos        x,
 228                            FT_Pos        y );
 229   FT_LOCAL( void )
 230   cff_builder_close_contour( CFF_Builder*  builder );
 231 
 232   FT_LOCAL( FT_Error )
 233   cff_builder_add_contour( CFF_Builder*  builder );
 234 
 235 
 236   /*************************************************************************/
 237   /*************************************************************************/
 238   /*****                                                               *****/
 239   /*****                            PS BUILDER                         *****/
 240   /*****                                                               *****/
 241   /*************************************************************************/
 242   /*************************************************************************/
 243 
 244   FT_LOCAL( void )
 245   ps_builder_init( PS_Builder*  ps_builder,
 246                    void*        builder,
 247                    FT_Bool      is_t1 );
 248 
 249 
 250   FT_LOCAL( void )
 251   ps_builder_done( PS_Builder*  builder );
 252 
 253   FT_LOCAL( FT_Error )
 254   ps_builder_check_points( PS_Builder*  builder,
 255                            FT_Int       count );
 256 
 257   FT_LOCAL( void )
 258   ps_builder_add_point( PS_Builder*  builder,
 259                         FT_Pos       x,
 260                         FT_Pos       y,
 261                         FT_Byte      flag );
 262 
 263   FT_LOCAL( FT_Error )
 264   ps_builder_add_point1( PS_Builder*  builder,
 265                          FT_Pos       x,
 266                          FT_Pos       y );
 267 
 268   FT_LOCAL( FT_Error )
 269   ps_builder_add_contour( PS_Builder*  builder );
 270 
 271   FT_LOCAL( FT_Error )
 272   ps_builder_start_point( PS_Builder*  builder,
 273                           FT_Pos       x,
 274                           FT_Pos       y );
 275 
 276   FT_LOCAL( void )
 277   ps_builder_close_contour( PS_Builder*  builder );
 278 
 279 
 280   /*************************************************************************/
 281   /*************************************************************************/
 282   /*****                                                               *****/
 283   /*****                            OTHER                              *****/
 284   /*****                                                               *****/
 285   /*************************************************************************/
 286   /*************************************************************************/
 287 
 288   FT_LOCAL( void )
 289   ps_decoder_init( PS_Decoder*  ps_decoder,
 290                    void*        decoder,
 291                    FT_Bool      is_t1 );
 292 
 293   FT_LOCAL( void )
 294   t1_make_subfont( FT_Face      face,
 295                    PS_Private   priv,
 296                    CFF_SubFont  subfont );
 297 
 298   FT_LOCAL( void )
 299   t1_decrypt( FT_Byte*   buffer,
 300               FT_Offset  length,
 301               FT_UShort  seed );
 302 
 303 
 304   FT_LOCAL( FT_UInt32 )
 305   cff_random( FT_UInt32  r );
 306 
 307 
 308 FT_END_HEADER
 309 
 310 #endif /* PSOBJS_H_ */
 311 
 312 
 313 /* END */