misc/libfreetype/src/cid/cidparse.c
author koda
Mon, 19 Nov 2012 00:49:24 +0100
changeset 8063 06efc1ea6a40
parent 5172 88f2e05288ba
permissions -rw-r--r--
linking phsyfs on osx
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  cidparse.c                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    CID-keyed Type1 parser (body).                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_INTERNAL_DEBUG_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include FT_INTERNAL_STREAM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include "cidparse.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
#include "ciderrs.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#define FT_COMPONENT  trace_cidparse
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
  /*****                    INPUT STREAM PARSER                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
  FT_LOCAL_DEF( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  cid_parser_new( CID_Parser*    parser,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
                  FT_Stream      stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
                  FT_Memory      memory,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
                  PSAux_Service  psaux )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    FT_Error  error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    FT_ULong  base_offset, offset, ps_len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    FT_Byte   *cur, *limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    FT_Byte   *arg1, *arg2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    FT_MEM_ZERO( parser, sizeof ( *parser ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    parser->stream = stream;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    base_offset = FT_STREAM_POS();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    /* first of all, check the font format in the header */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    if ( FT_FRAME_ENTER( 31 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    if ( ft_strncmp( (char *)stream->cursor,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
                     "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
      FT_TRACE2(( "[not a valid CID-keyed font]\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
      error = CID_Err_Unknown_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    FT_FRAME_EXIT();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  Again:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    /* now, read the rest of the file until we find */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    /* `StartData' or `/sfnts'                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      FT_Byte   buffer[256 + 10];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
      FT_Long   read_len = 256 + 10; /* same as signed FT_Stream->size */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
      FT_Byte*  p        = buffer;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      for ( offset = FT_STREAM_POS(); ; offset += 256 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
        FT_Long  stream_len; /* same as signed FT_Stream->size */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
        stream_len = stream->size - FT_STREAM_POS();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
        if ( stream_len == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
          FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
          error = CID_Err_Unknown_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
          goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
        read_len = FT_MIN( read_len, stream_len );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
        if ( FT_STREAM_READ( p, read_len ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
          goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
        if ( read_len < 256 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
          p[read_len]  = '\0';
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
        limit = p + read_len - 10;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
        for ( p = buffer; p < limit; p++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
          if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
          {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
            /* save offset of binary data after `StartData' */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
            offset += p - buffer + 10;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
            goto Found;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
          else if ( p[1] == 's' && ft_strncmp( (char*)p, "/sfnts", 6 ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
          {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
            offset += p - buffer + 7;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
            goto Found;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
        FT_MEM_MOVE( buffer, p, 10 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
        read_len = 256;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
        p = buffer + 10;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
  Found:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    /* We have found the start of the binary data or the `/sfnts' token. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    /* Now rewind and extract the frame corresponding to this PostScript */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    /* section.                                                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    ps_len = offset - base_offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    if ( FT_STREAM_SEEK( base_offset )                  ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
         FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
    parser->data_offset    = offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
    parser->postscript_len = ps_len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    parser->root.base      = parser->postscript;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    parser->root.cursor    = parser->postscript;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    parser->root.limit     = parser->root.cursor + ps_len;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    parser->num_dict       = -1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    /* Finally, we check whether `StartData' or `/sfnts' was real --  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    /* it could be in a comment or string.  We also get the arguments */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
    /* of `StartData' to find out whether the data is represented in  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    /* binary or hex format.                                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
    arg1 = parser->root.cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    cid_parser_skip_PS_token( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    cid_parser_skip_spaces  ( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
    arg2 = parser->root.cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    cid_parser_skip_PS_token( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    cid_parser_skip_spaces  ( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
    limit = parser->root.limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    cur   = parser->root.cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
    while ( cur < limit )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
      if ( parser->root.error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
        error = parser->root.error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
      if ( cur[0] == 'S' && ft_strncmp( (char*)cur, "StartData", 9 ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
        if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
          parser->binary_length = ft_atol( (const char *)arg2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
        limit = parser->root.limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
        cur   = parser->root.cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
      else if ( cur[1] == 's' && ft_strncmp( (char*)cur, "/sfnts", 6 ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
        FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
        error = CID_Err_Unknown_File_Format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
      cid_parser_skip_PS_token( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
      cid_parser_skip_spaces  ( parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
      arg1 = arg2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
      arg2 = cur;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
      cur  = parser->root.cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    /* we haven't found the correct `StartData'; go back and continue */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
    /* searching                                                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    FT_FRAME_RELEASE( parser->postscript );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
    if ( !FT_STREAM_SEEK( offset ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
      goto Again;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
  cid_parser_done( CID_Parser*  parser )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    /* always free the private dictionary */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    if ( parser->postscript )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
      FT_Stream  stream = parser->stream;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
      FT_FRAME_RELEASE( parser->postscript );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
    parser->root.funcs.done( &parser->root );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
/* END */