/***************************************************************************/
/* */
/* t42parse.c */
/* */
/* Type 42 font parser (body). */
/* */
/* Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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. */
/* */
/***************************************************************************/
#include "t42parse.h"
#include "t42error.h"
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_t42
static void
t42_parse_font_matrix( T42_Face face,
T42_Loader loader );
static void
t42_parse_encoding( T42_Face face,
T42_Loader loader );
static void
t42_parse_charstrings( T42_Face face,
T42_Loader loader );
static void
t42_parse_sfnts( T42_Face face,
T42_Loader loader );
/* as Type42 fonts have no Private dict, */
/* we set the last argument of T1_FIELD_XXX to 0 */
static const
T1_FieldRec t42_keywords[] =
{
#undef FT_STRUCTURE
#define FT_STRUCTURE T1_FontInfo
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_FONT_INFO
T1_FIELD_STRING( "version", version, 0 )
T1_FIELD_STRING( "Notice", notice, 0 )
T1_FIELD_STRING( "FullName", full_name, 0 )
T1_FIELD_STRING( "FamilyName", family_name, 0 )
T1_FIELD_STRING( "Weight", weight, 0 )
T1_FIELD_NUM ( "ItalicAngle", italic_angle, 0 )
T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
#undef FT_STRUCTURE
#define FT_STRUCTURE PS_FontExtraRec
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
T1_FIELD_NUM ( "FSType", fs_type, 0 )
#undef FT_STRUCTURE
#define FT_STRUCTURE T1_FontRec
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_FONT_DICT
T1_FIELD_KEY ( "FontName", font_name, 0 )
T1_FIELD_NUM ( "PaintType", paint_type, 0 )
T1_FIELD_NUM ( "FontType", font_type, 0 )
T1_FIELD_FIXED( "StrokeWidth", stroke_width, 0 )
#undef FT_STRUCTURE
#define FT_STRUCTURE FT_BBox
#undef T1CODE
#define T1CODE T1_FIELD_LOCATION_BBOX
T1_FIELD_BBOX("FontBBox", xMin, 0 )
T1_FIELD_CALLBACK( "FontMatrix", t42_parse_font_matrix, 0 )
T1_FIELD_CALLBACK( "Encoding", t42_parse_encoding, 0 )
T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings, 0 )
T1_FIELD_CALLBACK( "sfnts", t42_parse_sfnts, 0 )
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
};
#define T1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
#define T1_Done_Table( p ) \
do \
{ \
if ( (p)->funcs.done ) \
(p)->funcs.done( p ); \
} while ( 0 )
#define T1_Release_Table( p ) \
do \
{ \
if ( (p)->funcs.release ) \
(p)->funcs.release( p ); \
} while ( 0 )
#define T1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
#define T1_Skip_PS_Token( p ) (p)->root.funcs.skip_PS_token( &(p)->root )
#define T1_ToInt( p ) \
(p)->root.funcs.to_int( &(p)->root )
#define T1_ToBytes( p, b, m, n, d ) \
(p)->root.funcs.to_bytes( &(p)->root, b, m, n, d )
#define T1_ToFixedArray( p, m, f, t ) \
(p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
#define T1_ToToken( p, t ) \
(p)->root.funcs.to_token( &(p)->root, t )
#define T1_Load_Field( p, f, o, m, pf ) \
(p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
#define T1_Load_Field_Table( p, f, o, m, pf ) \
(p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
/********************* Parsing Functions ******************/
FT_LOCAL_DEF( FT_Error