Edit

kc3-lang/freetype/src/type42/t42parse.h

Branch :

  • Show log

    Commit

  • Author : Werner Lemberg
    Date : 2003-10-16 15:48:39
    Hash : e3f41982
    Message : Completely revised Type 42 parser. It now handles both fonts produced with ttftot42 (tested version 0.3.1) and TrueTypeToType42.ps (tested version May 2001; it is necessary to fix the broken header comment to be `%!PS-TrueTypeFont...'). * src/type42/t42objs.c (T42_GlyphSlot_Load): Change fourth parameter to `FT_UInt'. * src/type42/t42objs.h: Updated. * src/type42/t42parse.h (T42_ParserRec): Change type of `in_memory' to FT_Bool. (T42_Loader): Change type of `num_chars' and `num_glyphs' to FT_UInt. Add `swap_table' element. * src/type42/t42parse.c (T42_KEYWORD_COUNT, T1_ToFixed, T1_ToCoordArray, T1_ToTokenArray): Removed. (T1_ToBytes): New macro. (t42_is_alpha, t42_hexval): Removed. (t42_is_space): Handle `\0'. (t42_parse_encoding): Updated to use new PostScript parser routines from psaux. Handle `/Encoding [ ... ]' also. (T42_Load_Status): New enumeration. (t42_parse_sfnts): Updated to use new PostScript parser routines from psaux. (t42_parse_charstrings): Updated to use new PostScript parser routines from psaux. Handle `/CharStrings << ... >>' also. Don't expect that /.notdef is the first element in dictionary. Copy code from type1 module to handle this. (t42_parse_dict): Updated to use new PostScript parser routines from psaux. Remove code for synthetic fonts (which can't occur in Type 42 fonts). (t42_loader_done): Release `swap_table'. * src/psaux/psobjs.c (skip_string): Increase `cur' properly. * src/type1/t1load.c (parse_charstrings): Make test for `.notdef' faster.

  • src/type42/t42parse.h
  • /***************************************************************************/
    /*                                                                         */
    /*  t42parse.h                                                             */
    /*                                                                         */
    /*    Type 42 font parser (specification).                                 */
    /*                                                                         */
    /*  Copyright 2002, 2003 by Roberto Alameda.                               */
    /*                                                                         */
    /*  This file is part of the FreeType project, and may only be used,       */
    /*  modified, and distributed under the terms of the FreeType project      */
    /*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    /*  this file you indicate that you have read the license and              */
    /*  understand and accept it fully.                                        */
    /*                                                                         */
    /***************************************************************************/
    
    
    #ifndef __T42PARSE_H__
    #define __T42PARSE_H__
    
    
    #include "t42objs.h"
    #include FT_INTERNAL_POSTSCRIPT_AUX_H
    
    
    FT_BEGIN_HEADER
    
      typedef struct  T42_ParserRec_
      {
        PS_ParserRec  root;
        FT_Stream     stream;
    
        FT_Byte*      base_dict;
        FT_Long       base_len;
    
        FT_Bool       in_memory;
    
      } T42_ParserRec, *T42_Parser;
    
    
      typedef struct  T42_Loader_
      {
        T42_ParserRec  parser;          /* parser used to read the stream */
    
        FT_UInt        num_chars;       /* number of characters in encoding */
        PS_TableRec    encoding_table;  /* PS_Table used to store the       */
                                        /* encoding character names         */
    
        FT_UInt        num_glyphs;
        PS_TableRec    glyph_names;
        PS_TableRec    charstrings;
        PS_TableRec    swap_table;      /* For moving .notdef glyph to index 0. */
    
      } T42_LoaderRec, *T42_Loader;
    
    
      FT_LOCAL( FT_Error )
      t42_parser_init( T42_Parser     parser,
                       FT_Stream      stream,
                       FT_Memory      memory,
                       PSAux_Service  psaux );
    
      FT_LOCAL( void )
      t42_parser_done( T42_Parser  parser );
    
    
      FT_LOCAL( FT_Error )
      t42_parse_dict( T42_Face    face,
                      T42_Loader  loader,
                      FT_Byte*    base,
                      FT_Long     size );
    
    
      FT_LOCAL( void )
      t42_loader_init( T42_Loader  loader,
                       T42_Face    face );
    
      FT_LOCAL( void )
      t42_loader_done( T42_Loader  loader );
    
    
     /* */
    
    FT_END_HEADER
    
    
    #endif /* __T42PARSE_H__ */
    
    
    /* END */