misc/libfreetype/src/cff/cffparse.h
author Xeli
Fri, 24 Jun 2011 13:14:03 +0200
branchhedgeroid
changeset 5350 4c100fbfad5f
parent 5172 88f2e05288ba
permissions -rw-r--r--
Fixed a fault strcpy
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
/*  cffparse.h                                                             */
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
/*    CFF token stream parser (specification)                              */
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 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
#ifndef __CFF_PARSE_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#define __CFF_PARSE_H__
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include "cfftypes.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
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
FT_BEGIN_HEADER
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
#define CFF_MAX_STACK_DEPTH  96
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#define CFF_CODE_TOPDICT  0x1000
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#define CFF_CODE_PRIVATE  0x2000
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  typedef struct  CFF_ParserRec_
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
    FT_Library library;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
    FT_Byte*   start;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
    FT_Byte*   limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
    FT_Byte*   cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
    FT_Byte*   stack[CFF_MAX_STACK_DEPTH + 1];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    FT_Byte**  top;
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
    FT_UInt    object_code;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
    void*      object;
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
  } CFF_ParserRec, *CFF_Parser;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  FT_LOCAL( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
  cff_parser_init( CFF_Parser  parser,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
                   FT_UInt     code,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
                   void*       object,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
                   FT_Library  library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
  FT_LOCAL( FT_Error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
  cff_parser_run( CFF_Parser  parser,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
                  FT_Byte*    start,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
                  FT_Byte*    limit );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
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
  enum
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
    cff_kind_none = 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    cff_kind_num,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    cff_kind_fixed,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    cff_kind_fixed_thousand,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    cff_kind_string,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    cff_kind_bool,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    cff_kind_delta,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    cff_kind_callback,
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
    cff_kind_max  /* do not remove */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  };
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
  /* now generate handlers for the most simple fields */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  typedef FT_Error  (*CFF_Field_Reader)( CFF_Parser  parser );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  typedef struct  CFF_Field_Handler_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    int               kind;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    int               code;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    FT_UInt           offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    FT_Byte           size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
    CFF_Field_Reader  reader;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    FT_UInt           array_max;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    FT_UInt           count_offset;
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
  } CFF_Field_Handler;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
FT_END_HEADER
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
#endif /* __CFF_PARSE_H__ */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
/* END */