Commit 728da1c8 authored by David Turner's avatar David Turner
Browse files

changed file names and some functions names to avoid

conflicts with the "type1" driver.
parent a1be2dce
......@@ -31,17 +31,17 @@ T1Z_COMPILE := $(FT_COMPILE) $(T1Z_CFLAGS)
# Type1 driver sources (i.e., C files)
#
T1Z_DRV_SRC := $(T1Z_DIR_)t1parse.c \
$(T1Z_DIR_)t1load.c \
$(T1Z_DIR_)t1driver.c \
$(T1Z_DIR_)t1afm.c \
$(T1Z_DIR_)t1gload.c \
$(T1Z_DIR_)t1objs.c
T1Z_DRV_SRC := $(T1Z_DIR_)z1parse.c \
$(T1Z_DIR_)z1load.c \
$(T1Z_DIR_)z1driver.c \
$(T1Z_DIR_)z1afm.c \
$(T1Z_DIR_)z1gload.c \
$(T1Z_DIR_)z1objs.c
# Type1 driver headers
#
T1Z_DRV_H := $(T1Z_DRV_SRC:%.c=%.h) \
$(T1Z_DIR_)t1tokens.h
$(T1Z_DIR_)z1tokens.h
# Type1z driver object(s)
......
......@@ -29,13 +29,13 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
#include <t1parse.c>
#include <t1load.c>
#include <t1objs.c>
#include <t1driver.c>
#include <t1gload.c>
#include <z1parse.c>
#include <z1load.c>
#include <z1objs.c>
#include <z1driver.c>
#include <z1gload.c>
#ifndef T1_CONFIG_OPTION_NO_AFM
#include <t1afm.c>
#ifndef Z1_CONFIG_OPTION_NO_AFM
#include <z1afm.c>
#endif
......@@ -5,13 +5,13 @@
*
***************************************************************************/
#include <t1afm.h>
#include <z1afm.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
#include <stdlib.h> /* for qsort */
LOCAL_FUNC
void T1_Done_AFM( FT_Memory memory, T1_AFM* afm )
void Z1_Done_AFM( FT_Memory memory, Z1_AFM* afm )
{
FREE( afm->kern_pairs );
afm->num_pairs = 0;
......@@ -102,8 +102,8 @@
static
int compare_kern_pairs( const void* a, const void* b )
{
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
Z1_Kern_Pair* pair1 = (Z1_Kern_Pair*)a;
Z1_Kern_Pair* pair2 = (Z1_Kern_Pair*)b;
FT_ULong index1 = KERN_INDEX(pair1->glyph1,pair1->glyph2);
FT_ULong index2 = KERN_INDEX(pair2->glyph1,pair2->glyph2);
......@@ -115,7 +115,7 @@
/* parse an AFM file - for now, only read the kerning pairs */
LOCAL_FUNC
FT_Error T1_Read_AFM( FT_Face t1_face,
FT_Error Z1_Read_AFM( FT_Face t1_face,
FT_Stream stream )
{
FT_Error error;
......@@ -124,9 +124,9 @@
FT_Byte* limit;
FT_Byte* p;
FT_Int count = 0;
T1_Kern_Pair* pair;
Z1_Kern_Pair* pair;
T1_Font* type1 = &((T1_Face)t1_face)->type1;
T1_AFM* afm = 0;
Z1_AFM* afm = 0;
if ( ACCESS_Frame(stream->size) )
return error;
......@@ -150,7 +150,7 @@
/* allocate the pairs */
if ( ALLOC( afm, sizeof(*afm ) ) ||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
ALLOC_ARRAY( afm->kern_pairs, count, Z1_Kern_Pair ) )
goto Exit;
/* now, read each kern pair */
......@@ -183,7 +183,7 @@
}
/* now, sort the kern pairs according to their glyph indices */
qsort( afm->kern_pairs, count, sizeof(T1_Kern_Pair), compare_kern_pairs );
qsort( afm->kern_pairs, count, sizeof(Z1_Kern_Pair), compare_kern_pairs );
Exit:
if (error)
......@@ -196,12 +196,12 @@
/* find the kerning for a given glyph pair */
LOCAL_FUNC
void T1_Get_Kerning( T1_AFM* afm,
void Z1_Get_Kerning( Z1_AFM* afm,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning )
{
T1_Kern_Pair *min, *mid, *max;
Z1_Kern_Pair *min, *mid, *max;
FT_ULong index = KERN_INDEX(glyph1,glyph2);
/* simple binary search */
......
......@@ -16,33 +16,33 @@
/* In this version, we only read the kerning table from the */
/* AFM file. We may add support for ligatures a bit later.. */
typedef struct T1_Kern_Pair_
typedef struct Z1_Kern_Pair_
{
FT_UInt glyph1;
FT_UInt glyph2;
FT_Vector kerning;
} T1_Kern_Pair;
} Z1_Kern_Pair;
typedef struct T1_AFM_
typedef struct Z1_AFM_
{
FT_Int num_pairs;
T1_Kern_Pair* kern_pairs;
Z1_Kern_Pair* kern_pairs;
} T1_AFM;
} Z1_AFM;
LOCAL_DEF
FT_Error T1_Read_AFM( FT_Face face,
FT_Error Z1_Read_AFM( FT_Face face,
FT_Stream stream );
LOCAL_DEF
void T1_Done_AFM( FT_Memory memory,
T1_AFM* afm );
void Z1_Done_AFM( FT_Memory memory,
Z1_AFM* afm );
LOCAL_DEF
void T1_Get_Kerning( T1_AFM* afm,
void Z1_Get_Kerning( Z1_AFM* afm,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning );
......
......@@ -15,10 +15,10 @@
*
******************************************************************/
#include <t1driver.h>
#include <t1gload.h>
#include <t1load.h>
#include <t1afm.h>
#include <z1driver.h>
#include <z1gload.h>
#include <z1load.h>
#include <z1afm.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
......@@ -61,21 +61,21 @@
UNUSED(driver);
UNUSED(interface);
#ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT
#ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
return (FT_Module_Interface)T1_Get_Multi_Master;
return (FT_Module_Interface)Z1_Get_Multi_Master;
if ( strcmp( (const char*)interface, "set_mm_design") == 0 )
return (FT_Module_Interface)T1_Set_MM_Design;
return (FT_Module_Interface)Z1_Set_MM_Design;
if ( strcmp( (const char*)interface, "set_mm_blend") == 0 )
return (FT_Module_Interface)T1_Set_MM_Blend;
return (FT_Module_Interface)Z1_Set_MM_Blend;
#endif
return 0;
}
#ifndef T1_CONFIG_OPTION_NO_AFM
#ifndef Z1_CONFIG_OPTION_NO_AFM
/*************************************************************************/
/* */
/* <Function> */
......@@ -114,14 +114,14 @@
FT_UInt right_glyph,
FT_Vector* kerning )
{
T1_AFM* afm;
Z1_AFM* afm;
kerning->x = 0;
kerning->y = 0;
afm = (T1_AFM*)face->afm_data;
afm = (Z1_AFM*)face->afm_data;
if (afm)
T1_Get_Kerning( afm, left_glyph, right_glyph, kerning );
Z1_Get_Kerning( afm, left_glyph, right_glyph, kerning );
return T1_Err_Ok;
}
......@@ -235,17 +235,17 @@
0, /* format interface */
(FT_Module_Constructor) T1_Init_Driver,
(FT_Module_Destructor) T1_Done_Driver,
(FT_Module_Constructor) Z1_Init_Driver,
(FT_Module_Destructor) Z1_Done_Driver,
(FT_Module_Requester) Get_Interface,
},
sizeof( T1_FaceRec ),
sizeof( T1_SizeRec ),
sizeof( T1_GlyphSlotRec ),
sizeof( Z1_SizeRec ),
sizeof( Z1_GlyphSlotRec ),
(FTDriver_initFace) T1_Init_Face,
(FTDriver_doneFace) T1_Done_Face,
(FTDriver_initFace) Z1_Init_Face,
(FTDriver_doneFace) Z1_Done_Face,
(FTDriver_initSize) 0,
(FTDriver_doneSize) 0,
(FTDriver_initGlyphSlot) 0,
......@@ -253,15 +253,15 @@
(FTDriver_setCharSizes) 0,
(FTDriver_setPixelSizes) 0,
(FTDriver_loadGlyph) T1_Load_Glyph,
(FTDriver_loadGlyph) Z1_Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index,
#ifdef T1_CONFIG_OPTION_NO_AFM
#ifdef Z1_CONFIG_OPTION_NO_AFM
(FTDriver_getKerning) 0,
(FTDriver_attachFile) 0,
#else
(FTDriver_getKerning) Get_Kerning,
(FTDriver_attachFile) T1_Read_AFM,
(FTDriver_attachFile) Z1_Read_AFM,
#endif
(FTDriver_getAdvances) 0
......
......@@ -15,14 +15,14 @@
*
******************************************************************/
#include <t1gload.h>
#include <z1gload.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#undef FT_COMPONENT
#define FT_COMPONENT trace_t1gload
typedef enum T1_Operator_
typedef enum Z1_Operator_
{
op_none = 0,
op_endchar,
......@@ -53,7 +53,7 @@
op_max /* never remove this one */
} T1_Operator;
} Z1_Operator;
static const FT_Int t1_args_count[ op_max ] =
{
......@@ -101,7 +101,7 @@
/*********************************************************************
*
* <Function>
* T1_Init_Builder
* Z1_Init_Builder
*
* <Description>
* Initialise a given glyph builder.
......@@ -115,10 +115,10 @@
*********************************************************************/
LOCAL_FUNC
void T1_Init_Builder( T1_Builder* builder,
void Z1_Init_Builder( Z1_Builder* builder,
T1_Face face,
T1_Size size,
T1_GlyphSlot glyph )
Z1_Size size,
Z1_GlyphSlot glyph )
{
builder->path_begun = 0;
builder->load_points = 1;
......@@ -157,7 +157,7 @@
/*********************************************************************
*
* <Function>
* T1_Done_Builder
* Z1_Done_Builder
*
* <Description>
* Finalise a given glyph builder. Its content can still be
......@@ -170,9 +170,9 @@
*********************************************************************/
LOCAL_FUNC
void T1_Done_Builder( T1_Builder* builder )
void Z1_Done_Builder( Z1_Builder* builder )
{
T1_GlyphSlot glyph = builder->glyph;
Z1_GlyphSlot glyph = builder->glyph;
if (glyph)
glyph->root.outline = *builder->base;
......@@ -183,7 +183,7 @@
/*********************************************************************
*
* <Function>
* T1_Init_Decoder
* Z1_Init_Decoder
*
* <Description>
* Initialise a given Type 1 decoder for parsing
......@@ -195,7 +195,7 @@
*********************************************************************/
LOCAL_FUNC
void T1_Init_Decoder( T1_Decoder* decoder )
void Z1_Init_Decoder( Z1_Decoder* decoder )
{
decoder->top = 0;
decoder->zone = 0;
......@@ -210,7 +210,7 @@
/* check that there is enough room for "count" more points */
static
FT_Error check_points( T1_Builder* builder,
FT_Error check_points( Z1_Builder* builder,
FT_Int count )
{
return FT_GlyphLoader_Check_Points( builder->loader, count, 0 );
......@@ -219,7 +219,7 @@
/* add a new point, do not check room */
static
void add_point( T1_Builder* builder,
void add_point( Z1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag )
......@@ -244,7 +244,7 @@
/* check room for a new on-curve point, then add it */
static
FT_Error add_point1( T1_Builder* builder,
FT_Error add_point1( Z1_Builder* builder,
FT_Pos x,
FT_Pos y )
{
......@@ -260,7 +260,7 @@
/* check room for a new contour, then add it */
static
FT_Error add_contour( T1_Builder* builder )
FT_Error add_contour( Z1_Builder* builder )
{
FT_Outline* outline = builder->current;
FT_Error error;
......@@ -285,7 +285,7 @@
/* if a path was begun, add its first on-curve point */
static
FT_Error start_point( T1_Builder* builder,
FT_Error start_point( Z1_Builder* builder,
FT_Pos x,
FT_Pos y )
{
......@@ -304,7 +304,7 @@
/* close the current contour */
static
void close_contour( T1_Builder* builder )
void close_contour( Z1_Builder* builder )
{
FT_Outline* outline = builder->current;
......@@ -382,7 +382,7 @@
*********************************************************************/
static
FT_Error t1operator_seac( T1_Decoder* decoder,
FT_Error t1operator_seac( Z1_Decoder* decoder,
FT_Pos asb,
FT_Pos adx,
FT_Pos ady,
......@@ -447,7 +447,7 @@
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
error = T1_Parse_CharStrings( decoder,
error = Z1_Parse_CharStrings( decoder,
type1->charstrings [bchar_index],
type1->charstrings_len[bchar_index],
type1->num_subrs,
......@@ -469,7 +469,7 @@
/* Now load `achar' on top of */
/* the base outline */
error = T1_Parse_CharStrings( decoder,
error = Z1_Parse_CharStrings( decoder,
type1->charstrings [achar_index],
type1->charstrings_len[achar_index],
type1->num_subrs,
......@@ -501,7 +501,7 @@
/*********************************************************************
*
* <Function>
* T1_Parse_CharStrings
* Z1_Parse_CharStrings
*
* <Description>
* Parses a given Type 1 charstrings program
......@@ -522,7 +522,7 @@
#define USE_ARGS(n) top -= n; if (top < decoder->stack) goto Stack_Underflow
LOCAL_FUNC
FT_Error T1_Parse_CharStrings( T1_Decoder* decoder,
FT_Error Z1_Parse_CharStrings( Z1_Decoder* decoder,
FT_Byte* charstring_base,
FT_Int charstring_len,
FT_Int num_subrs,
......@@ -530,10 +530,10 @@
FT_Int* subrs_len )
{
FT_Error error;
T1_Decoder_Zone* zone;
Z1_Decoder_Zone* zone;
FT_Byte* ip;
FT_Byte* limit;
T1_Builder* builder = &decoder->builder;
Z1_Builder* builder = &decoder->builder;
FT_Outline* outline;
FT_Pos x, y;
......@@ -558,7 +558,7 @@
while ( ip < limit )
{
FT_Int* top = decoder->top;
T1_Operator op = op_none;
Z1_Operator op = op_none;
FT_Long value = 0;
/********************************************************************/
......@@ -791,7 +791,7 @@
}
num_points = top[1] - 13 + (top[1] == 18);
if (top[0] != num_points*blend->num_designs)
if (top[0] != (FT_Int)(num_points*blend->num_designs))
{
FT_ERROR(( "T1.Parse_CharStrings: incorrect number of mm arguments\n" ));
goto Syntax_Error;
......@@ -1192,19 +1192,19 @@
/**********************************************************************/
LOCAL_FUNC
FT_Error T1_Compute_Max_Advance( T1_Face face,
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int *max_advance )
{
FT_Error error;
T1_Decoder decoder;
Z1_Decoder decoder;
FT_Int glyph_index;
T1_Font* type1 = &face->type1;
*max_advance = 0;
/* Initialise load decoder */
T1_Init_Decoder( &decoder );
T1_Init_Builder( &decoder.builder, face, 0, 0 );
Z1_Init_Decoder( &decoder );
Z1_Init_Builder( &decoder.builder, face, 0, 0 );
decoder.blend = face->blend;
decoder.builder.metrics_only = 1;
......@@ -1215,7 +1215,7 @@
for ( glyph_index = 0; glyph_index < type1->num_glyphs; glyph_index++ )
{
/* now get load the unscaled outline */
error = T1_Parse_CharStrings( &decoder,
error = Z1_Parse_CharStrings( &decoder,
type1->charstrings [glyph_index],
type1->charstrings_len[glyph_index],
type1->num_subrs,
......@@ -1246,13 +1246,13 @@
LOCAL_FUNC
FT_Error T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
FT_Error Z1_Load_Glyph( Z1_GlyphSlot glyph,
Z1_Size size,
FT_Int glyph_index,
FT_Int load_flags )
{
FT_Error error;
T1_Decoder decoder;
Z1_Decoder decoder;
T1_Face face = (T1_Face)glyph->root.face;
FT_Bool hinting;
T1_Font* type1 = &face->type1;
......@@ -1269,17 +1269,17 @@
hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
( load_flags & FT_LOAD_NO_HINTING ) == 0;
glyph->root.format = ft_glyph_format_none;
glyph->root.format = ft_glyph_format_outline;
{
T1_Init_Decoder( &decoder );
T1_Init_Builder( &decoder.builder, face, size, glyph );
Z1_Init_Decoder( &decoder );
Z1_Init_Builder( &decoder.builder, face, size, glyph );
decoder.blend = ((T1_Face)glyph->root.face)->blend;
decoder.builder.no_recurse = (FT_Bool)!!(load_flags & FT_LOAD_NO_RECURSE);
/* now load the unscaled outline */
error = T1_Parse_CharStrings( &decoder,
error = Z1_Parse_CharStrings( &decoder,
type1->charstrings [glyph_index],
type1->charstrings_len[glyph_index],
type1->num_subrs,
......@@ -1287,7 +1287,7 @@
type1->subrs_len );
/* save new glyph tables */
T1_Done_Builder( &decoder.builder );
Z1_Done_Builder( &decoder.builder );
}
/* Now, set the metrics.. - this is rather simple, as : */
......
......@@ -17,12 +17,12 @@
* The Type 1 glyph loader uses three distinct objects to build
* scaled and hinted outlines from a charstrings program. These are :
*
* - a glyph builder, T1_Builder, used to store the built outline
* - a glyph builder, Z1_Builder, used to store the built outline
*
* - a glyph hinter, T1_Hinter, used to record and apply the stem
* - a glyph hinter, Z1_Hinter, used to record and apply the stem
* hints
*
* - a charstrings interpreter, T1_Decoder, used to parse the
* - a charstrings interpreter, Z1_Decoder, used to parse the
* Type 1 charstrings stream, manage a stack and call the builder
* and/or hinter depending on the opcodes.
*
......@@ -35,7 +35,7 @@
#ifndef T1GLOAD_H
#define T1GLOAD_H
#include <t1objs.h>
#include <z1objs.h>
#ifdef __cplusplus
extern "C" {
......@@ -44,7 +44,7 @@
/*************************************************************************/
/* */
/* <Structure> T1_Builder */
/* <Structure> Z1_Builder */
/* */
/* <Description> */
/* a structure used during glyph loading to store its outline. */
......@@ -81,11 +81,11 @@
/* all of its points.. */
/* */
typedef struct T1_Builder_
typedef struct Z1_Builder_
{
FT_Memory memory;
T1_Face face;
T1_GlyphSlot glyph;
Z1_GlyphSlot glyph;
FT_GlyphLoader* loader;
FT_Outline* current; /* the current glyph outline */
......@@ -110,28 +110,28 @@
FT_Error error; /* only used for memory errors */
FT_Bool metrics_only;
} T1_Builder;
} Z1_Builder;
/* execution context charstring zone */
typedef struct T1_Decoder_Zone_
typedef struct Z1_Decoder_Zone_
{
FT_Byte* base;
FT_Byte* limit;
FT_Byte* cursor;
} T1_Decoder_Zone;
} Z1_Decoder_Zone;
typedef struct T1_Decoder_
typedef struct Z1_Decoder_
{
T1_Builder builder;
Z1_Builder builder;
FT_Int stack[ T1_MAX_CHARSTRINGS_OPERANDS ];
FT_Int* top;
T1_Decoder_Zone zones[ T1_MAX_SUBRS_CALLS+1 ];
T1_Decoder_Zone* zone;