zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
afmparse.c File Reference
#include <ft2build.h>
#include <FT_FREETYPE_H>
#include <FT_INTERNAL_POSTSCRIPT_AUX_H>
#include "afmparse.h"
#include "psconv.h"
#include "psauxerr.h"

Go to the source code of this file.

Macros

#define AFM_GETC()
 
#define AFM_IS_EOF(ch)   ( (ch) == EOF || (ch) == '\x1a' )
 
#define AFM_IS_NEWLINE(ch)   ( (ch) == '\r' || (ch) == '\n' )
 
#define AFM_IS_SEP(ch)   ( (ch) == ';' )
 
#define AFM_IS_SPACE(ch)   ( (ch) == ' ' || (ch) == '\t' )
 
#define AFM_STATUS_EOC(stream)   ( (stream)->status >= AFM_STREAM_STATUS_EOC )
 
#define AFM_STATUS_EOF(stream)   ( (stream)->status >= AFM_STREAM_STATUS_EOF )
 
#define AFM_STATUS_EOL(stream)   ( (stream)->status >= AFM_STREAM_STATUS_EOL )
 
#define AFM_STREAM_KEY_BEGIN(stream)   (char*)( (stream)->cursor - 1 )
 
#define AFM_STREAM_KEY_LEN(stream, key)   ( (char*)(stream)->cursor - key - 1 )
 
#define EOF   -1
 
#define KERN_INDEX(g1, g2)   ( ( (FT_ULong)g1 << 16 ) | g2 )
 

Typedefs

typedef struct AFM_StreamRec_ AFM_StreamRec
 
typedef enum AFM_Token_ AFM_Token
 

Enumerations

enum  { AFM_STREAM_STATUS_NORMAL, AFM_STREAM_STATUS_EOC, AFM_STREAM_STATUS_EOL, AFM_STREAM_STATUS_EOF }
 
enum  AFM_Token_ {
  AFM_TOKEN_ASCENDER, AFM_TOKEN_AXISLABEL, AFM_TOKEN_AXISTYPE, AFM_TOKEN_B,
  AFM_TOKEN_BLENDAXISTYPES, AFM_TOKEN_BLENDDESIGNMAP, AFM_TOKEN_BLENDDESIGNPOSITIONS, AFM_TOKEN_C,
  AFM_TOKEN_CC, AFM_TOKEN_CH, AFM_TOKEN_CAPHEIGHT, AFM_TOKEN_CHARWIDTH,
  AFM_TOKEN_CHARACTERSET, AFM_TOKEN_CHARACTERS, AFM_TOKEN_DESCENDER, AFM_TOKEN_ENCODINGSCHEME,
  AFM_TOKEN_ENDAXIS, AFM_TOKEN_ENDCHARMETRICS, AFM_TOKEN_ENDCOMPOSITES, AFM_TOKEN_ENDDIRECTION,
  AFM_TOKEN_ENDFONTMETRICS, AFM_TOKEN_ENDKERNDATA, AFM_TOKEN_ENDKERNPAIRS, AFM_TOKEN_ENDTRACKKERN,
  AFM_TOKEN_ESCCHAR, AFM_TOKEN_FAMILYNAME, AFM_TOKEN_FONTBBOX, AFM_TOKEN_FONTNAME,
  AFM_TOKEN_FULLNAME, AFM_TOKEN_ISBASEFONT, AFM_TOKEN_ISCIDFONT, AFM_TOKEN_ISFIXEDPITCH,
  AFM_TOKEN_ISFIXEDV, AFM_TOKEN_ITALICANGLE, AFM_TOKEN_KP, AFM_TOKEN_KPH,
  AFM_TOKEN_KPX, AFM_TOKEN_KPY, AFM_TOKEN_L, AFM_TOKEN_MAPPINGSCHEME,
  AFM_TOKEN_METRICSSETS, AFM_TOKEN_N, AFM_TOKEN_NOTICE, AFM_TOKEN_PCC,
  AFM_TOKEN_STARTAXIS, AFM_TOKEN_STARTCHARMETRICS, AFM_TOKEN_STARTCOMPOSITES, AFM_TOKEN_STARTDIRECTION,
  AFM_TOKEN_STARTFONTMETRICS, AFM_TOKEN_STARTKERNDATA, AFM_TOKEN_STARTKERNPAIRS, AFM_TOKEN_STARTKERNPAIRS0,
  AFM_TOKEN_STARTKERNPAIRS1, AFM_TOKEN_STARTTRACKKERN, AFM_TOKEN_STDHW, AFM_TOKEN_STDVW,
  AFM_TOKEN_TRACKKERN, AFM_TOKEN_UNDERLINEPOSITION, AFM_TOKEN_UNDERLINETHICKNESS, AFM_TOKEN_VV,
  AFM_TOKEN_VVECTOR, AFM_TOKEN_VERSION, AFM_TOKEN_W, AFM_TOKEN_W0,
  AFM_TOKEN_W0X, AFM_TOKEN_W0Y, AFM_TOKEN_W1, AFM_TOKEN_W1X,
  AFM_TOKEN_W1Y, AFM_TOKEN_WX, AFM_TOKEN_WY, AFM_TOKEN_WEIGHT,
  AFM_TOKEN_WEIGHTVECTOR, AFM_TOKEN_XHEIGHT, N_AFM_TOKENS, AFM_TOKEN_UNKNOWN
}
 

Functions

 afm_compare_kern_pairs (const void *a, const void *b)
 
static FT_Error afm_parse_kern_data (AFM_Parser parser)
 
static FT_Error afm_parse_kern_pairs (AFM_Parser parser)
 
static FT_Error afm_parse_track_kern (AFM_Parser parser)
 
 afm_parser_done (AFM_Parser parser)
 
 afm_parser_init (AFM_Parser parser, FT_Memory memory, FT_Byte *base, FT_Byte *limit)
 
 afm_parser_next_key (AFM_Parser parser, FT_Bool line, FT_Offset *len)
 
 afm_parser_parse (AFM_Parser parser)
 
 afm_parser_read_int (AFM_Parser parser, FT_Int *aint)
 
 afm_parser_read_vals (AFM_Parser parser, AFM_Value vals, FT_UInt n)
 
static FT_Error afm_parser_skip_section (AFM_Parser parser, FT_UInt n, AFM_Token end_section)
 
static char * afm_stream_read_one (AFM_Stream stream)
 
static char * afm_stream_read_string (AFM_Stream stream)
 
static int afm_stream_skip_spaces (AFM_Stream stream)
 
static AFM_Token afm_tokenize (const char *key, FT_Offset len)
 

Variables

static const char *const afm_key_table [N_AFM_TOKENS]
 

Macro Definition Documentation

#define AFM_GETC ( )
Value:
( ( (stream)->cursor < (stream)->limit ) ? *(stream)->cursor++ \
: EOF )
GLuint GLuint stream
Definition: glew.h:6573
#define EOF
Definition: afmparse.c:57

Definition at line 70 of file afmparse.c.

Referenced by afm_stream_read_one(), afm_stream_read_string(), and afm_stream_skip_spaces().

#define AFM_IS_EOF (   ch)    ( (ch) == EOF || (ch) == '\x1a' )

Definition at line 64 of file afmparse.c.

Referenced by afm_stream_read_one(), afm_stream_read_string(), and afm_stream_skip_spaces().

#define AFM_IS_NEWLINE (   ch)    ( (ch) == '\r' || (ch) == '\n' )

Definition at line 62 of file afmparse.c.

Referenced by afm_stream_read_one(), afm_stream_read_string(), and afm_stream_skip_spaces().

#define AFM_IS_SEP (   ch)    ( (ch) == ';' )

Definition at line 68 of file afmparse.c.

Referenced by afm_stream_read_one(), and afm_stream_skip_spaces().

#define AFM_IS_SPACE (   ch)    ( (ch) == ' ' || (ch) == '\t' )

Definition at line 65 of file afmparse.c.

Referenced by afm_stream_read_one(), and afm_stream_skip_spaces().

#define AFM_STATUS_EOC (   stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOC )

Definition at line 80 of file afmparse.c.

Referenced by afm_parser_next_key(), afm_stream_read_one(), and afm_stream_skip_spaces().

#define AFM_STATUS_EOF (   stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOF )

Definition at line 86 of file afmparse.c.

Referenced by afm_parser_next_key().

#define AFM_STATUS_EOL (   stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOL )

Definition at line 83 of file afmparse.c.

Referenced by afm_parser_next_key(), and afm_stream_read_string().

#define AFM_STREAM_KEY_BEGIN (   stream)    (char*)( (stream)->cursor - 1 )

Definition at line 74 of file afmparse.c.

Referenced by afm_stream_read_one(), and afm_stream_read_string().

#define AFM_STREAM_KEY_LEN (   stream,
  key 
)    ( (char*)(stream)->cursor - key - 1 )

Definition at line 77 of file afmparse.c.

Referenced by afm_parser_next_key(), and afm_parser_read_vals().

#define KERN_INDEX (   g1,
  g2 
)    ( ( (FT_ULong)g1 << 16 ) | g2 )

Definition at line 656 of file afmparse.c.

Referenced by afm_compare_kern_pairs().

Typedef Documentation

typedef struct AFM_StreamRec_ AFM_StreamRec
typedef enum AFM_Token_ AFM_Token

Enumeration Type Documentation

anonymous enum
Enumerator
AFM_STREAM_STATUS_NORMAL 
AFM_STREAM_STATUS_EOC 
AFM_STREAM_STATUS_EOL 
AFM_STREAM_STATUS_EOF 

Definition at line 36 of file afmparse.c.

enum AFM_Token_
Enumerator
AFM_TOKEN_ASCENDER 
AFM_TOKEN_AXISLABEL 
AFM_TOKEN_AXISTYPE 
AFM_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N_STDVW 
AFM_TOKEN_TRACKKERN 
AFM_TOKEN_UNDERLINEPOSITION 
AFM_TOKEN_UNDERLINETHICKNESS 
AFM_TOKEN_VV 
AFM_TOKEN_VVECTOR 
AFM_TOKEN_VERSION 
AFM_TOKEN_W 
AFM_TOKEN_W0 
AFM_TOKEN_W0X 
AFM_TOKEN_W0Y 
AFM_TOKEN_W1 
AFM_TOKEN_W1X 
AFM_TOKEN_W1Y 
AFM_TOKEN_WX 
AFM_TOKEN_WY 
AFM_TOKEN_WEIGHT 
AFM_TOKEN_WEIGHTVECTOR 
AFM_TOKEN_XHEIGHT 
N_AFM_TOKENS 
AFM_TOKEN_UNKNOWN 

Definition at line 198 of file afmparse.c.

Function Documentation

afm_compare_kern_pairs ( const void a,
const void b 
)

Definition at line 661 of file afmparse.c.

References AFM_KernPairRec_::index1, AFM_KernPairRec_::index2, and KERN_INDEX.

Referenced by afm_parse_kern_pairs().

afm_parser_done ( AFM_Parser  parser)

Definition at line 553 of file afmparse.c.

References FT_FREE.

afm_parser_init ( AFM_Parser  parser,
FT_Memory  memory,
FT_Byte base,
FT_Byte limit 
)

Definition at line 525 of file afmparse.c.

References AFM_STREAM_STATUS_EOL, error, FT_NEW, and NULL.

afm_parser_read_int ( AFM_Parser  parser,
FT_Int aint 
)
static FT_Error afm_parser_skip_section ( AFM_Parser  parser,
FT_UInt  n,
AFM_Token  end_section 
)
static

Definition at line 814 of file afmparse.c.

References afm_parser_next_key(), AFM_TOKEN_ENDFONTMETRICS, afm_tokenize(), and NULL.

Referenced by afm_parser_parse().

static char* afm_stream_read_string ( AFM_Stream  stream)
static
static int afm_stream_skip_spaces ( AFM_Stream  stream)
static
static AFM_Token afm_tokenize ( const char *  key,
FT_Offset  len 
)
static

Variable Documentation

const char* const afm_key_table[N_AFM_TOKENS]
static

Definition at line 280 of file afmparse.c.

Referenced by afm_tokenize().