the psaux module is now nearly completed

the "type1z" driver uses it to parse Type 1 charstrings
(not to parse the Type 1 token stream yet though)..
This commit is contained in:
David Turner 2000-08-22 22:36:33 +00:00
parent 48721c11b5
commit 9748807412
21 changed files with 1484 additions and 1781 deletions

View File

@ -335,14 +335,6 @@
/*************************************************************************/
/*************************************************************************/
/* */
/* T1_MAX_STACK_DEPTH is the maximal depth of the token stack used by */
/* the Type 1 parser (see t1load.c). A minimum of 16 is required. */
/* */
#define T1_MAX_STACK_DEPTH 16
/*************************************************************************/
/* */
/* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */
@ -363,10 +355,10 @@
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
/*************************************************************************/
/* */
/* Define T1_CONFIG_OPTION_DISABLE_HINTER if you want to generate a */

View File

@ -84,6 +84,10 @@
trace_t1load,
trace_t1objs,
/* Postcript helper module 'psaux' */
trace_t1decode,
trace_psobjs,
/* experimental Type 1 driver components */
trace_z1driver,
trace_z1gload,

View File

@ -22,7 +22,7 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/t1types.h>
#ifdef __cplusplus
extern "C" {
@ -419,6 +419,7 @@
FT_Bool path_begun;
FT_Bool load_points;
FT_Bool no_recurse;
FT_Bool shift;
FT_Error error; /* only used for memory errors */
FT_Bool metrics_only;
@ -427,14 +428,14 @@
typedef FT_Error (*T1_Builder_Check_Points_Func) ( T1_Builder* builder,
FT_Int count );
FT_Int count );
typedef void (*T1_Builder_Add_Point_Func) ( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag );
typedef void (*T1_Builder_Add_Point1_Func) ( T1_Builder* builder,
typedef FT_Error (*T1_Builder_Add_Point1_Func) ( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
@ -465,6 +466,103 @@
} T1_Builder_Funcs;
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 DECODER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
#if 0
#define T1_MAX_CHARSTRINGS_OPERANDS 64
#define T1_MAX_SUBRS_CALLS 16
/*************************************************************************/
/* */
/* T1_MAX_SUBRS_CALLS details the maximum number of nested sub-routine */
/* calls during glyph loading. */
/* */
#define T1_MAX_SUBRS_CALLS 8
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
#endif
typedef struct T1_Decoder_Zone_
{
FT_Byte* cursor;
FT_Byte* base;
FT_Byte* limit;
} T1_Decoder_Zone;
typedef struct T1_Decoder_ T1_Decoder;
typedef struct T1_Decoder_Funcs_ T1_Decoder_Funcs;
typedef FT_Error (*T1_Decoder_Parse_Func)( T1_Decoder* decoder,
FT_UInt glyph_index );
struct T1_Decoder_
{
T1_Builder builder;
FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS];
FT_Long* top;
T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
T1_Decoder_Zone* zone;
PSNames_Interface* psnames; /* for seac */
FT_UInt num_glyphs;
FT_Byte** glyph_names;
FT_UInt lenIV; /* internal for sub routine calls */
FT_UInt num_subrs;
FT_Byte** subrs;
FT_Int* subrs_len; /* array of subrs length (optional) */
FT_Matrix font_matrix;
FT_Int flex_state;
FT_Int num_flex_vectors;
FT_Vector flex_vectors[7];
T1_Blend* blend; /* for multiple master support */
const T1_Decoder_Funcs* funcs;
T1_Decoder_Parse_Func parse_glyph;
};
struct T1_Decoder_Funcs_
{
FT_Error (*init) ( T1_Decoder* decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
T1_Blend* blend,
T1_Decoder_Parse_Func parse );
void (*done) ( T1_Decoder* decoder );
FT_Error (*parse_charstrings)( T1_Decoder* decoder,
FT_Byte* base,
FT_UInt len );
};
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -478,6 +576,7 @@
const PS_Table_Funcs* t1_table_funcs;
const T1_Parser_Funcs* t1_parser_funcs;
const T1_Builder_Funcs* t1_builder_funcs;
const T1_Decoder_Funcs* t1_decoder_funcs;
void (*t1_decrypt)( FT_Byte* buffer,
FT_Int length,

View File

@ -165,6 +165,7 @@
FT_FaceRec root;
T1_Font type1;
void* psnames;
void* psaux;
void* afm_data;
FT_CharMapRec charmaprecs[2];
FT_CharMap charmaps[2];

View File

@ -859,335 +859,7 @@
}
#if 0
/*************************************************************************/
/*************************************************************************/
/**** ****/
/**** EXPERIMENTAL EMBOLDENING/OUTLINING SUPPORT ****/
/**** ****/
/*************************************************************************/
/*************************************************************************/
/* Compute the norm of a vector */
#ifdef FT_CONFIG_OPTION_OLD_CALCS
static
FT_Pos ft_norm( FT_Vector* vec )
{
FT_Int64 t1, t2;
MUL_64( vec->x, vec->x, t1 );
MUL_64( vec->y, vec->y, t2 );
ADD_64( t1, t2, t1 );
return (FT_Pos)SQRT_64( t1 );
}
#else /* FT_CONFIG_OPTION_OLD_CALCS */
static
FT_Pos ft_norm( FT_Vector* vec )
{
FT_F26Dot6 u, v, d;
FT_Int shift;
FT_ULong H, L, L2, hi, lo, med;
u = vec->x; if ( u < 0 ) u = -u;
v = vec->y; if ( v < 0 ) v = -v;
if ( u < v )
{
d = u;
u = v;
v = d;
}
/* check that we are not trying to normalize zero! */
if ( u == 0 )
return 0;
/* compute (u*u + v*v) on 64 bits with two 32-bit registers [H:L] */
hi = (FT_ULong)u >> 16;
lo = (FT_ULong)u & 0xFFFF;
med = hi * lo;
H = hi * hi + ( med >> 15 );
med <<= 17;
L = lo * lo + med;
if ( L < med )
H++;
hi = (FT_ULong)v >> 16;
lo = (FT_ULong)v & 0xFFFF;
med = hi * lo;
H += hi * hi + ( med >> 15 );
med <<= 17;
L2 = lo * lo + med;
if ( L2 < med )
H++;
L += L2;
if ( L < L2 )
H++;
/* if the value is smaller than 32 bits */
shift = 0;
if ( H == 0 )
{
while ( ( L & 0xC0000000UL ) == 0 )
{
L <<= 2;
shift++;
}
return ( FT_Sqrt32( L ) >> shift );
}
else
{
while ( H )
{
L = ( L >> 2 ) | ( H << 30 );
H >>= 2;
shift++;
}
return ( FT_Sqrt32( L ) << shift );
}
}
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
static
int ft_test_extrema( FT_Outline* outline,
int n )
{
FT_Vector *prev, *cur, *next;
FT_Pos product;
FT_Int first, last;
/* we need to compute the `previous' and `next' point */
/* for these extrema. */
cur = outline->points + n;
prev = cur - 1;
next = cur + 1;
first = 0;
for ( c = 0; c < outline->n_contours; c++ )
{
last = outline->contours[c];
if ( n == first )
prev = outline->points + last;
if ( n == last )
next = outline->points + first;
first = last + 1;
}
product = FT_MulDiv( cur->x - prev->x, /* in.x */
next->y - cur->y, /* out.y */
0x40 )
-
FT_MulDiv( cur->y - prev->y, /* in.y */
next->x - cur->x, /* out.x */
0x40 );
if ( product )
product = product > 0 ? 1 : -1;
return product;
}
/* Compute the orientation of path filling. It differs between TrueType */
/* and Type1 formats. We could use the `ft_outline_reverse_fill' flag, */
/* but it is better to re-compute it directly (it seems that this flag */
/* isn't correctly set for some weird composite glyphs currently). */
/* */
/* We do this by computing bounding box points, and computing their */
/* curvature. */
/* */
/* The function returns either 1 or -1. */
/* */
static
int ft_get_orientation( FT_Outline* outline )
{
FT_BBox box;
FT_BBox indices;
int n, last;
indices.xMin = -1;
indices.yMin = -1;
indices.xMax = -1;
indices.yMax = -1;
box.xMin = box.yMin = 32767;
box.xMax = box.yMax = -32768;
/* is it empty ? */
if ( outline->n_contours < 1 )
return 1;
last = outline->contours[outline->n_contours - 1];
for ( n = 0; n <= last; n++ )
{
FT_Pos x, y;
x = outline->points[n].x;
if ( x < box.xMin )
{
box.xMin = x;
indices.xMin = n;
}
if ( x > box.xMax )
{
box.xMax = x;
indices.xMax = n;
}
y = outline->points[n].y;
if ( y < box.yMin )
{
box.yMin = y;
indices.yMin = n;
}
if ( y > box.yMax )
{
box.yMax = y;
indices.yMax = n;
}
}
/* test orientation of the xmin */
n = ft_test_extrema( outline, indices.xMin );
if (n) goto Exit;
n = ft_test_extrema( outline, indices.yMin );
if (n) goto Exit;
n = ft_test_extrema( outline, indices.xMax );
if (n) goto Exit;
n = ft_test_extrema( outline, indices.yMax );
if (!n)
n = 1;
Exit:
return n;
}
static
FT_Error ft_embolden( FT_Face original,
FT_Outline* outline,
FT_Pos* advance )
{
FT_Vector u, v;
FT_Vector* points;
FT_Vector cur, prev, next;
FT_Pos distance;
int c, n, first, orientation;
FT_UNUSED( advance );
/* compute control distance */
distance = FT_MulFix( original->em_size / 60,
original->size->metrics.y_scale );
orientation = ft_get_orientation( &original->glyph->outline );
points = original->glyph->outline.points;
first = 0;
for ( c = 0; c < outline->n_contours; c++ )
{
int last = outline->contours[c];
prev = points[last];
for ( n = first; n <= last; n++ )
{
FT_Pos norm, delta, d;
FT_Vector in, out;
cur = points[n];
if ( n < last ) next = points[n + 1];
else next = points[first];
/* compute the in and out vectors */
in.x = cur.x - prev.x;
in.y = cur.y - prev.y;
out.x = next.x - cur.x;
out.y = next.y - cur.y;
/* compute U and V */
norm = ft_norm( &in );
u.x = orientation * FT_DivFix( in.y, norm );
u.y = orientation * -FT_DivFix( in.x, norm );
norm = ft_norm( &out );
v.x = orientation * FT_DivFix( out.y, norm );
v.y = orientation * -FT_DivFix( out.x, norm );
d = distance;
if ( ( outline->flags[n] & FT_Curve_Tag_On ) == 0 )
d *= 2;
/* Check discriminant for parallel vectors */
delta = FT_MulFix( u.x, v.y ) - FT_MulFix( u.y, v.x );
if ( delta > FT_BOLD_THRESHOLD || delta < -FT_BOLD_THRESHOLD )
{
/* Move point -- compute A and B */
FT_Pos x, y, A, B;
A = d + FT_MulFix( cur.x, u.x ) + FT_MulFix( cur.y, u.y );
B = d + FT_MulFix( cur.x, v.x ) + FT_MulFix( cur.y, v.y );
x = FT_MulFix( A, v.y ) - FT_MulFix( B, u.y );
y = FT_MulFix( B, u.x ) - FT_MulFix( A, v.x );
outline->points[n].x = distance + FT_DivFix( x, delta );
outline->points[n].y = distance + FT_DivFix( y, delta );
}
else
{
/* Vectors are nearly parallel */
FT_Pos x, y;
x = distance + cur.x + FT_MulFix( d, u.x + v.x ) / 2;
y = distance + cur.y + FT_MulFix( d, u.y + v.y ) / 2;
outline->points[n].x = x;
outline->points[n].y = y;
}
prev = cur;
}
first = last + 1;
}
if ( advance )
*advance = ( *advance + distance * 4 ) & -64;
return 0;
}
#if 1
#endif /* 0 -- EXPERIMENTAL STUFF! */

View File

@ -33,7 +33,6 @@
#include <freetype/internal/ftstream.h>
#include <freetype/ftoutln.h>
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */

7
src/psaux/module.mk Normal file
View File

@ -0,0 +1,7 @@
make_module_list: add_psaux_module
add_psaux_module:
$(OPEN_DRIVER)psaux_module_class$(CLOSE_DRIVER)
$(ECHO_DRIVER)psaux $(ECHO_DRIVER_DESC)Postscript Type 1 & Type 2 helper module$(ECHO_DRIVER_DONE)
# EOF

16
src/psaux/psaux.c Normal file
View File

@ -0,0 +1,16 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE
#include "psobjs.c"
#include "psmodule.c"
#include "t1decode.c"
#else
#include <psaux/psobjs.c>
#include <psaux/psmodule.c>
#include <psaux/t1decode.c>
#endif

82
src/psaux/psmodule.c Normal file
View File

@ -0,0 +1,82 @@
#include <psaux/psmodule.h>
#include <psaux/psobjs.h>
#include <psaux/t1decode.h>
static
const PS_Table_Funcs ps_table_funcs =
{
PS_Table_New,
PS_Table_Done,
PS_Table_Add,
PS_Table_Release
};
static
const T1_Parser_Funcs t1_parser_funcs =
{
T1_Init_Parser,
T1_Done_Parser,
T1_Skip_Spaces,
T1_Skip_Alpha,
T1_ToInt,
T1_ToFixed,
T1_ToCoordArray,
T1_ToFixedArray,
T1_ToToken,
T1_ToTokenArray,
T1_Load_Field,
T1_Load_Field_Table
};
static
const T1_Builder_Funcs t1_builder_funcs =
{
T1_Builder_Init,
T1_Builder_Done,
T1_Builder_Check_Points,
T1_Builder_Add_Point,
T1_Builder_Add_Point1,
T1_Builder_Add_Contour,
T1_Builder_Start_Point,
T1_Builder_Close_Contour
};
static
const T1_Decoder_Funcs t1_decoder_funcs =
{
T1_Decoder_Init,
T1_Decoder_Done,
T1_Decoder_Parse_Charstrings
};
static
const PSAux_Interface psaux_interface =
{
&ps_table_funcs,
&t1_parser_funcs,
&t1_builder_funcs,
&t1_decoder_funcs,
T1_Decrypt
};
FT_CPLUSPLUS(const FT_Module_Class) psaux_module_class =
{
0,
sizeof( FT_ModuleRec ),
"psaux",
0x10000L,
0x20000L,
&psaux_interface, /* module-specific interface */
(FT_Module_Constructor) 0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
};

16
src/psaux/psmodule.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef PSMODULE_H
#define PSMODULE_H
#include <freetype/ftmodule.h>
#ifdef __cplusplus
extern "C" {
#endif
FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
#ifdef __cplusplus
}
#endif
#endif /* PSMODULE_H */

View File

@ -229,7 +229,7 @@
FT_Memory memory = table->memory;
if ( table->init == 0xDEADBEEFL )
if ( (FT_ULong)table->init == 0xDEADBEEFUL )
{
FREE( table->block );
FREE( table->elements );
@ -1133,9 +1133,13 @@
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
point->x = x >> 16;
point->y = y >> 16;
if (builder->shift)
{
x >>= 16;
y >>= 16;
}
point->x = x;
point->y = y;
*control = flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic;
builder->last = *point;

70
src/psaux/rules.mk Normal file
View File

@ -0,0 +1,70 @@
#
# FreeType 2 PSAUX driver configuration rules
#
# Copyright 1996-2000 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.
# PSAUX driver directory
#
PSAUX_DIR := $(SRC_)psaux
PSAUX_DIR_ := $(PSAUX_DIR)$(SEP)
# compilation flags for the driver
#
PSAUX_COMPILE := $(FT_COMPILE)
# PSAUX driver sources (i.e., C files)
#
PSAUX_DRV_SRC := $(PSAUX_DIR_)psobjs.c \
$(PSAUX_DIR_)t1decode.c \
$(PSAUX_DIR_)psmodule.c
# PSAUX driver headers
#
PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h)
# PSAUX driver object(s)
#
# PSAUX_DRV_OBJ_M is used during `multi' builds.
# PSAUX_DRV_OBJ_S is used during `single' builds.
#
PSAUX_DRV_OBJ_M := $(PSAUX_DRV_SRC:$(PSAUX_DIR_)%.c=$(OBJ_)%.$O)
PSAUX_DRV_OBJ_S := $(OBJ_)psaux.$O
# PSAUX driver source file for single build
#
PSAUX_DRV_SRC_S := $(PSAUX_DIR_)psaux.c
# PSAUX driver - single object
#
$(PSAUX_DRV_OBJ_S): $(PSAUX_DRV_SRC_S) $(PSAUX_DRV_SRC) \
$(FREETYPE_H) $(PSAUX_DRV_H)
$(PSAUX_COMPILE) $T$@ $(PSAUX_DRV_SRC_S)
# PSAUX driver - multiple objects
#
$(OBJ_)%.$O: $(PSAUX_DIR_)%.c $(FREETYPE_H) $(PSAUX_DRV_H)
$(PSAUX_COMPILE) $T$@ $<
# update main driver object lists
#
DRV_OBJS_S += $(PSAUX_DRV_OBJ_S)
DRV_OBJS_M += $(PSAUX_DRV_OBJ_M)
# EOF

1026
src/psaux/t1decode.c Normal file

File diff suppressed because it is too large Load Diff

32
src/psaux/t1decode.h Normal file
View File

@ -0,0 +1,32 @@
#ifndef T1DECODE_H
#define T1DECODE_H
#include <freetype/internal/psaux.h>
#include <freetype/internal/psnames.h>
#include <freetype/internal/t1types.h>
LOCAL_DEF
const T1_Decoder_Funcs t1_decoder_funcs;
LOCAL_DEF
FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
FT_UInt glyph_index );
LOCAL_DEF
FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
FT_Byte* base,
FT_UInt len );
LOCAL_DEF
FT_Error T1_Decoder_Init( T1_Decoder* decoder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Byte** glyph_names,
T1_Blend* blend,
T1_Decoder_Parse_Func parse_glyph );
LOCAL_DEF
void T1_Decoder_Done( T1_Decoder* decoder );
#endif /* T1DECODE_H */

File diff suppressed because it is too large Load Diff

View File

@ -36,139 +36,11 @@
#endif
/*************************************************************************/
/* */
/* <Structure> */
/* Z1_Builder */
/* */
/* <Description> */
/* A structure used during glyph loading to store its outline. */
/* */
/* <Fields> */
/* memory :: The current memory object. */
/* */
/* face :: The current face object. */
/* */
/* glyph :: The current glyph slot. */
/* */
/* loader :: The current glyph loader. */
/* */
/* current :: The current glyph outline. */
/* */
/* base :: The base glyph outline. */
/* */
/* last :: The last point position. */
/* */
/* scale_x :: The horizontal scale (FUnits to sub-pixels). */
/* */
/* scale_y :: The vertical scale (FUnits to sub-pixels). */
/* */
/* pos_x :: The horizontal translation (for composite glyphs). */
/* */
/* pos_y :: The vertical translation (for composite glyphs). */
/* */
/* left_bearing :: The left side bearing point. */
/* */
/* advance :: The horizontal advance vector. */
/* */
/* no_recurse :: */
/* */
/* bbox :: The glyph's bounding box. */
/* */
/* path_begun :: A flag which indicates that a new path has begun. */
/* */
/* load_points :: A flag which indicates, if not set, that no points */
/* are loaded. */
/* */
/* error :: The current error code. */
/* */
/* metrics_only :: A flag whether to compute metrics only. */
/* */
typedef struct Z1_Builder_
{
FT_Memory memory;
T1_Face face;
Z1_GlyphSlot glyph;
FT_GlyphLoader* loader;
FT_Outline* current; /* the current glyph outline */
FT_Outline* base; /* the composite glyph outline */
FT_Vector last;
FT_Fixed scale_x;
FT_Fixed scale_y;
FT_Pos pos_x;
FT_Pos pos_y;
FT_Vector left_bearing;
FT_Vector advance;
FT_BBox bbox; /* bounding box */
FT_Bool path_begun;
FT_Bool load_points;
FT_Bool no_recurse;
FT_Error error; /* only used for memory errors */
FT_Bool metrics_only;
} Z1_Builder;
/* execution context charstring zone */
typedef struct Z1_Decoder_Zone_
{
FT_Byte* base;
FT_Byte* limit;
FT_Byte* cursor;
} Z1_Decoder_Zone;
typedef struct Z1_Decoder_
{
Z1_Builder builder;
FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS];
FT_Int* top;
Z1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
Z1_Decoder_Zone* zone;
FT_Int flex_state;
FT_Int num_flex_vectors;
FT_Vector flex_vectors[7];
T1_Blend* blend; /* for multiple masters */
} Z1_Decoder;
LOCAL_DEF
void Z1_Init_Builder( Z1_Builder* builder,
T1_Face face,
Z1_Size size,
Z1_GlyphSlot glyph );
LOCAL_DEF
void Z1_Done_Builder( Z1_Builder* builder );
LOCAL_DEF
void Z1_Init_Decoder( Z1_Decoder* decoder );
LOCAL_DEF
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance );
LOCAL_DEF
FT_Error Z1_Parse_CharStrings( Z1_Decoder* decoder,
FT_Byte* charstring_base,
FT_Int charstring_len,
FT_Int num_subrs,
FT_Byte** subrs_base,
FT_Int* subrs_len );
LOCAL_DEF
FT_Error Z1_Load_Glyph( Z1_GlyphSlot glyph,
Z1_Size size,

View File

@ -634,7 +634,7 @@
}
Z1_ToToken( parser, &master );
if ( master.type != t1_token_array )
if ( master.type != z1_token_array )
{
FT_ERROR(( "parse_weight_vector: incorrect format!\n" ));
error = T1_Err_Invalid_File_Format;
@ -699,42 +699,42 @@
#define Z1_NEW_STRING( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_STRING( _field );
#define Z1_NEW_BOOL( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_BOOL( _field );
#define Z1_NEW_NUM( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_NUM( _field );
#define Z1_NEW_FIXED( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_FIXED( _field, _power );
#define Z1_NEW_NUM_TABLE( _name, _field, _max, _count ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_NUM_ARRAY( _field, _count, _max );
#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_FIXED_ARRAY( _field, _count, _max );
#define Z1_NEW_NUM_TABLE2( _name, _field, _max ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_NUM_ARRAY2( _field, _max );
#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
const Z1_Field_Rec z1_field_ ## _field = \
Z1_FIELD_FIXED_ARRAY2( _field, _max );
@ -808,29 +808,29 @@
#define Z1_KEYWORD_TYPE1( name, f ) \
{ \
name, t1_keyword_field, t1_keyword_type1, 0, &t1_field_ ## f \
name, t1_keyword_field, t1_keyword_type1, 0, &z1_field_ ## f \
}
#define Z1_KEYWORD_FONTINFO( name, f ) \
{ \
name, t1_keyword_field, t1_keyword_font_info, 0, &t1_field_ ## f \
name, t1_keyword_field, t1_keyword_font_info, 0, &z1_field_ ## f \
}
#define Z1_KEYWORD_PRIVATE( name, f ) \
{ \
name, t1_keyword_field, t1_keyword_private, 0, &t1_field_ ## f \
name, t1_keyword_field, t1_keyword_private, 0, &z1_field_ ## f \
}
#define Z1_KEYWORD_FONTINFO_TABLE( name, f ) \
{ \
name, t1_keyword_field_table, t1_keyword_font_info, 0, \
&t1_field_ ## f \
&z1_field_ ## f \
}
#define Z1_KEYWORD_PRIVATE_TABLE( name, f ) \
{ \
name, t1_keyword_field_table, t1_keyword_private, 0, \
&t1_field_ ## f \
&z1_field_ ## f \
}
@ -1518,7 +1518,7 @@
Z1_ToToken( &loader->parser, &token );
/* if the last token was an array, skip it! */
if ( token.type == t1_token_array )
if ( token.type == z1_token_array )
cur2 = parser->cursor;
}
cur = cur2;

View File

@ -20,7 +20,7 @@
#define Z1LOAD_H
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
#include <freetype/internal/psaux.h>
#include <freetype/ftmm.h>

View File

@ -36,6 +36,7 @@
#include <freetype/internal/psnames.h>
#include <freetype/internal/psaux.h>
/*************************************************************************/
@ -158,6 +159,7 @@
{
FT_Error error;
PSNames_Interface* psnames;
PSAux_Interface* psaux;
FT_UNUSED( num_params );
FT_UNUSED( params );
@ -176,6 +178,15 @@
face->psnames = psnames;
}
psaux = (PSAux_Interface*)face->psaux;
if (!psaux)
{
psaux = (PSAux_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" );
face->psaux = psaux;
}
/* open the tokenizer, this will also check the font format */
error = Z1_Open_Face( face );
if ( error )

View File

@ -326,7 +326,7 @@
FT_Int embed;
token->type = t1_token_none;
token->type = z1_token_none;
token->start = 0;
token->limit = 0;
@ -342,19 +342,19 @@
{
/************* check for strings ***********************/
case '(':
token->type = t1_token_string;
token->type = z1_token_string;
ender = ')';
goto Lookup_Ender;
/************* check for programs/array ****************/
case '{':
token->type = t1_token_array;
token->type = z1_token_array;
ender = '}';
goto Lookup_Ender;
/************* check for table/array ******************/
case '[':
token->type = t1_token_array;
token->type = z1_token_array;
ender = ']';
Lookup_Ender:
@ -381,7 +381,7 @@
/* **************** otherwise, it's any token **********/
default:
token->start = cur++;
token->type = t1_token_any;
token->type = z1_token_any;
while ( cur < limit && !IS_Z1_SPACE( *cur ) )
cur++;
@ -391,7 +391,7 @@
if ( !token->limit )
{
token->start = 0;
token->type = t1_token_none;
token->type = z1_token_none;
}
parser->cursor = cur;
@ -411,7 +411,7 @@
*pnum_tokens = -1;
Z1_ToToken( parser, &master );
if ( master.type == t1_token_array )
if ( master.type == z1_token_array )
{
FT_Byte* old_cursor = parser->cursor;
FT_Byte* old_limit = parser->limit;
@ -819,7 +819,7 @@
cur = token.start;
limit = token.limit;
if ( token.type == t1_token_array )
if ( token.type == z1_token_array )
{
/* if this is an array, and we have no blend, an error occurs */
if ( max_objects == 0 )
@ -837,15 +837,15 @@
switch ( field->type )
{
case t1_field_bool:
case z1_field_bool:
val = t1_tobool( &cur, limit );
goto Store_Integer;
case t1_field_fixed:
case z1_field_fixed:
val = t1_tofixed( &cur, limit, 3 );
goto Store_Integer;
case t1_field_integer:
case z1_field_integer:
val = t1_toint( &cur, limit );
Store_Integer:
@ -868,7 +868,7 @@
}
break;
case t1_field_string:
case z1_field_string:
{
FT_Memory memory = parser->memory;
FT_UInt len = limit-cur;

View File

@ -30,13 +30,13 @@
/* simple enumeration type used to identify token types */
typedef enum Z1_Token_Type_
{
t1_token_none = 0,
t1_token_any,
t1_token_string,
t1_token_array,
z1_token_none = 0,
z1_token_any,
z1_token_string,
z1_token_array,
/* do not remove */
t1_token_max
z1_token_max
} Z1_Token_Type;
@ -54,16 +54,16 @@
/* enumeration type used to identify object fields */
typedef enum Z1_Field_Type_
{
t1_field_none = 0,
t1_field_bool,
t1_field_integer,
t1_field_fixed,
t1_field_string,
t1_field_integer_array,
t1_field_fixed_array,
z1_field_none = 0,
z1_field_bool,
z1_field_integer,
z1_field_fixed,
z1_field_string,
z1_field_integer_array,
z1_field_fixed_array,
/* do not remove */
t1_field_max
z1_field_max
} Z1_Field_Type;
@ -83,7 +83,7 @@
#define Z1_FIELD_BOOL( _fname ) \
{ \
t1_field_bool, \
z1_field_bool, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, 0 \
@ -91,7 +91,7 @@
#define Z1_FIELD_NUM( _fname ) \
{ \
t1_field_integer, \
z1_field_integer, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, 0 \
@ -99,7 +99,7 @@
#define Z1_FIELD_FIXED( _fname, _power ) \
{ \
t1_field_fixed, \
z1_field_fixed, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, 0 \
@ -107,7 +107,7 @@
#define Z1_FIELD_STRING( _fname ) \
{ \
t1_field_string, \
z1_field_string, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE( _fname ), \
0, 0, 0 \
@ -115,7 +115,7 @@
#define Z1_FIELD_NUM_ARRAY( _fname, _fcount, _fmax ) \
{ \
t1_field_integer, \
z1_field_integer, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_fmax, \
@ -125,7 +125,7 @@
#define Z1_FIELD_FIXED_ARRAY( _fname, _fcount, _fmax ) \
{ \
t1_field_fixed, \
z1_field_fixed, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_fmax, \
@ -135,7 +135,7 @@
#define Z1_FIELD_NUM_ARRAY2( _fname, _fmax ) \
{ \
t1_field_integer, \
z1_field_integer, \
FT_FIELD_OFFSET( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_fmax, \
@ -144,7 +144,7 @@
#define Z1_FIELD_FIXED_ARRAY2( _fname, _fmax ) \
{ \
t1_field_fixed, \
z1_field_fixed, \
FT_FIELD_OFFSTE( _fname ), \
FT_FIELD_SIZE_DELTA( _fname ), \
_fmax, \