w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

afmparse.c File Reference
#include <freetype/freetype.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/psaux.h>
#include "afmparse.h"
#include "psconv.h"
#include "psauxerr.h"
Include dependency graph for afmparse.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  AFM_StreamRec_
 

Macros

#define EOF   -1
 
#define AFM_IS_NEWLINE(ch)   ( (ch) == '\r' || (ch) == '\n' )
 
#define AFM_IS_EOF(ch)   ( (ch) == EOF || (ch) == '\x1a' )
 
#define AFM_IS_SPACE(ch)   ( (ch) == ' ' || (ch) == '\t' )
 
#define AFM_IS_SEP(ch)   ( (ch) == ';' )
 
#define AFM_GETC()
 
#define AFM_STREAM_KEY_BEGIN(stream)    (char*)( (stream)->cursor - 1 )
 
#define AFM_STREAM_KEY_LEN(stream, key)    (FT_Offset)( (char*)(stream)->cursor - key - 1 )
 
#define AFM_STATUS_EOC(stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOC )
 
#define AFM_STATUS_EOL(stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOL )
 
#define AFM_STATUS_EOF(stream)    ( (stream)->status >= AFM_STREAM_STATUS_EOF )
 
#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 ,
  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

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

Variables

static const char *const afm_key_table [N_AFM_TOKENS]
 

Macro Definition Documentation

◆ AFM_GETC

#define AFM_GETC ( )
Value:
( ( (stream)->cursor < (stream)->limit ) ? *(stream)->cursor++ \
: EOF )
#define EOF
Definition: afmparse.c:59
struct stream_s stream
Definition: pts_fax.h:93

Definition at line 72 of file afmparse.c.

◆ AFM_IS_EOF

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

Definition at line 66 of file afmparse.c.

◆ AFM_IS_NEWLINE

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

Definition at line 64 of file afmparse.c.

◆ AFM_IS_SEP

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

Definition at line 70 of file afmparse.c.

◆ AFM_IS_SPACE

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

Definition at line 67 of file afmparse.c.

◆ AFM_STATUS_EOC

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

Definition at line 82 of file afmparse.c.

◆ AFM_STATUS_EOF

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

Definition at line 88 of file afmparse.c.

◆ AFM_STATUS_EOL

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

Definition at line 85 of file afmparse.c.

◆ AFM_STREAM_KEY_BEGIN

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

Definition at line 76 of file afmparse.c.

◆ AFM_STREAM_KEY_LEN

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

Definition at line 79 of file afmparse.c.

◆ EOF

#define EOF   -1

Definition at line 59 of file afmparse.c.

◆ KERN_INDEX

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

Definition at line 666 of file afmparse.c.

Typedef Documentation

◆ AFM_StreamRec

typedef struct AFM_StreamRec_ AFM_StreamRec

◆ AFM_Token

typedef enum AFM_Token_ AFM_Token

AFM_Parser

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

afmparse.c

AFM parser (body).

Copyright (C) 2006-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.

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. AFM_Stream

The use of AFM_Stream is largely inspired by parseAFM.[ch] from t1lib.

Enumerator
AFM_STREAM_STATUS_NORMAL 
AFM_STREAM_STATUS_EOC 
AFM_STREAM_STATUS_EOL 
AFM_STREAM_STATUS_EOF 

Definition at line 38 of file afmparse.c.

◆ AFM_Token_

enum AFM_Token_

AFM_Parser

Enumerator
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 
A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FM_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 

Definition at line 202 of file afmparse.c.

Function Documentation

◆ afm_compare_kern_pairs()

afm_compare_kern_pairs ( const void a,
const void b 
)

Definition at line 671 of file afmparse.c.

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

Referenced by afm_parse_kern_pairs().

◆ afm_parse_kern_data()

◆ afm_parse_kern_pairs()

◆ afm_parse_track_kern()

◆ afm_parser_done()

afm_parser_done ( AFM_Parser  parser)

Definition at line 557 of file afmparse.c.

References FT_FREE.

◆ afm_parser_init()

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

afmparse.h

AFM parser (specification).

Copyright (C) 2006-2020 by David Turner, Robert Wilhelm, and Werner Lemberg.

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.

Definition at line 529 of file afmparse.c.

References AFM_STREAM_STATUS_EOL, base, error, FT_Err_Ok, FT_NEW, limit, and NULL.

◆ afm_parser_next_key()

◆ afm_parser_parse()

◆ afm_parser_read_int()

static FT_Error afm_parser_read_int ( AFM_Parser  parser,
FT_Int aint 
)
static

◆ afm_parser_read_vals()

◆ afm_parser_skip_section()

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

Definition at line 831 of file afmparse.c.

References afm_parser_next_key(), AFM_TOKEN_ENDFONTMETRICS, afm_tokenize(), FT_Err_Ok, FT_THROW, key, len, n, and NULL.

Referenced by afm_parser_parse().

◆ afm_stream_read_one()

◆ afm_stream_read_string()

◆ afm_stream_skip_spaces()

◆ afm_tokenize()

Variable Documentation

◆ afm_key_table

const char* const afm_key_table[N_AFM_TOKENS]
static

Definition at line 284 of file afmparse.c.

Referenced by afm_tokenize().