removing obsolete files

This commit is contained in:
David Turner 2000-08-23 22:50:39 +00:00
parent b8a7a0bdea
commit 888706a317
19 changed files with 0 additions and 9440 deletions

View File

@ -1,6 +0,0 @@
make_module_list: add_type1_driver
add_type1_driver:
$(OPEN_DRIVER)t1_driver_class$(CLOSE_DRIVER)
$(ECHO_DRIVER)type1 $(ECHO_DRIVER_DESC)Postscript font files with extension *.pfa or *.pfb$(ECHO_DRIVER_DONE)

View File

@ -1,74 +0,0 @@
#
# FreeType 2 Type 1 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.
# Type1 driver directory
#
T1_DIR := $(SRC_)type1
T1_DIR_ := $(T1_DIR)$(SEP)
# compilation flags for the driver
#
T1_COMPILE := $(FT_COMPILE)
# Type1 driver sources (i.e., C files)
#
T1_DRV_SRC := $(T1_DIR_)t1objs.c \
$(T1_DIR_)t1load.c \
$(T1_DIR_)t1parse.c \
$(T1_DIR_)t1tokens.c \
$(T1_DIR_)t1driver.c \
$(T1_DIR_)t1hinter.c \
$(T1_DIR_)t1afm.c \
$(T1_DIR_)t1gload.c
# Type1 driver headers
#
T1_DRV_H := $(T1_DRV_SRC:%.c=%.h)
# Type1 driver object(s)
#
# T1_DRV_OBJ_M is used during `multi' builds
# T1_DRV_OBJ_S is used during `single' builds
#
T1_DRV_OBJ_M := $(T1_DRV_SRC:$(T1_DIR_)%.c=$(OBJ_)%.$O)
T1_DRV_OBJ_S := $(OBJ_)type1.$O
# Type1 driver source file for single build
#
T1_DRV_SRC_S := $(T1_DIR_)type1.c
# Type1 driver - single object
#
$(T1_DRV_OBJ_S): $(T1_DRV_SRC_S) $(T1_DRV_SRC) $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $(T1_DRV_SRC_S)
# Type1 driver - multiple objects
#
$(OBJ_)%.$O: $(T1_DIR_)%.c $(FREETYPE_H) $(T1_DRV_H)
$(T1_COMPILE) $T$@ $<
# update main driver object lists
#
DRV_OBJS_S += $(T1_DRV_OBJ_S)
DRV_OBJS_M += $(T1_DRV_OBJ_M)
# EOF

View File

@ -1,293 +0,0 @@
/***************************************************************************/
/* */
/* t1afm.c */
/* */
/* AFM support for Type 1 fonts (body). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifdef FT_FLAT_COMPILE
#include "t1afm.h"
#else
#include <type1/t1afm.h>
#endif
#include <freetype/internal/ftstream.h>
#include <freetype/internal/t1types.h>
#include <stdlib.h> /* for qsort() */
#include <string.h> /* for strcmp() */
#include <ctype.h> /* for isalnum() */
/*************************************************************************/
/* */
/* 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_t1afm
LOCAL_FUNC
void T1_Done_AFM( FT_Memory memory,
T1_AFM* afm )
{
FREE( afm->kern_pairs );
afm->num_pairs = 0;
}
#undef IS_KERN_PAIR
#define IS_KERN_PAIR( p ) ( p[0] == 'K' && p[1] == 'P' )
#define IS_ALPHANUM( c ) ( isalnum( c ) || \
c == '_' || \
c == '.' )
/* read a glyph name and return the equivalent glyph index */
static
FT_UInt afm_atoindex( FT_Byte** start,
FT_Byte* limit,
T1_Font* type1 )
{
FT_Byte* p = *start;
FT_Int len;
FT_UInt result = 0;
char temp[64];
/* skip whitespace */
while ( ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) &&
p < limit )
p++;
*start = p;
/* now, read glyph name */
while ( IS_ALPHANUM( *p ) && p < limit )
p++;
len = p - *start;
if ( len > 0 && len < 64 )
{
FT_Int n;
/* copy glyph name to intermediate array */
MEM_Copy( temp, *start, len );
temp[len] = 0;
/* lookup glyph name in face array */
for ( n = 0; n < type1->num_glyphs; n++ )
{
char* gname = (char*)type1->glyph_names[n];
if ( gname && gname[0] == temp[0] && strcmp( gname, temp ) == 0 )
{
result = n;
break;
}
}
}
*start = p;
return result;
}
/* read an integer */
static
int afm_atoi( FT_Byte** start,
FT_Byte* limit )
{
FT_Byte* p = *start;
int sum = 0;
int sign = 1;
/* skip everything that is not a number */
while ( p < limit && !isdigit( *p ) )
{
sign = 1;
if ( *p == '-' )
sign = -1;
p++;
}
while ( p < limit && isdigit( *p ) )
{
sum = sum * 10 + ( *p - '0' );
p++;
}
*start = p;
return sum * sign;
}
#undef KERN_INDEX
#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
/* compare two kerning pairs */
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;
FT_ULong index1 = KERN_INDEX( pair1->glyph1, pair1->glyph2 );
FT_ULong index2 = KERN_INDEX( pair2->glyph1, pair2->glyph2 );
return ( index1 - index2 );
}
/* parse an AFM file -- for now, only read the kerning pairs */
LOCAL_FUNC
FT_Error T1_Read_AFM( FT_Face t1_face,
FT_Stream stream )
{
FT_Error error;
FT_Memory memory = stream->memory;
FT_Byte* start;
FT_Byte* limit;
FT_Byte* p;
FT_Int count = 0;
T1_Kern_Pair* pair;
T1_Font* type1 = &((T1_Face)t1_face)->type1;
T1_AFM* afm = 0;
if ( ACCESS_Frame( stream->size ) )
return error;
start = (FT_Byte*)stream->cursor;
limit = (FT_Byte*)stream->limit;
p = start;
/* we are now going to count the occurences of `KP' or `KPX' in */
/* the AFM file */
count = 0;
for ( p = start; p < limit - 3; p++ )
{
if ( IS_KERN_PAIR( p ) )
count++;
}
/* Actually, kerning pairs are simply optional! */
if ( count == 0 )
goto Exit;
/* allocate the pairs */
if ( ALLOC( afm, sizeof ( *afm ) ) ||
ALLOC_ARRAY( afm->kern_pairs, count, T1_Kern_Pair ) )
goto Exit;
/* now, read each kern pair */
pair = afm->kern_pairs;
afm->num_pairs = count;
/* save in face object */
((T1_Face)t1_face)->afm_data = afm;
for ( p = start; p < limit - 3; p++ )
{
if ( IS_KERN_PAIR( p ) )
{
FT_Byte* q;
/* skip keyword (KP or KPX) */
q = p + 2;
if ( *q == 'X' )
q++;
pair->glyph1 = afm_atoindex( &q, limit, type1 );
pair->glyph2 = afm_atoindex( &q, limit, type1 );
pair->kerning.x = afm_atoi( &q, limit );
pair->kerning.y = 0;
if ( p[2] != 'X' )
pair->kerning.y = afm_atoi( &q, limit );
pair++;
}
}
/* now, sort the kern pairs according to their glyph indices */
qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ),
compare_kern_pairs );
Exit:
if ( error )
FREE( afm );
FORGET_Frame();
return error;
}
/* find the kerning for a given glyph pair */
LOCAL_FUNC
void T1_Get_Kerning( T1_AFM* afm,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning )
{
T1_Kern_Pair *min, *mid, *max;
FT_ULong index = KERN_INDEX( glyph1, glyph2 );
/* simple binary search */
min = afm->kern_pairs;
max = min + afm->num_pairs - 1;
while ( min <= max )
{
FT_ULong midi;
mid = min + ( max - min ) / 2;
midi = KERN_INDEX( mid->glyph1, mid->glyph2 );
if ( midi == index )
{
*kerning = mid->kerning;
return;
}
if ( midi < index )
min = mid + 1;
else
max = mid - 1;
}
kerning->x = 0;
kerning->y = 0;
}
/* END */

View File

@ -1,70 +0,0 @@
/***************************************************************************/
/* */
/* t1afm.h */
/* */
/* AFM support for Type 1 fonts (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1AFM_H
#define T1AFM_H
#include <freetype/internal/ftobjs.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct T1_Kern_Pair_
{
FT_UInt glyph1;
FT_UInt glyph2;
FT_Vector kerning;
} T1_Kern_Pair;
typedef struct T1_AFM_
{
FT_Int num_pairs;
T1_Kern_Pair* kern_pairs;
} T1_AFM;
LOCAL_DEF
FT_Error T1_Read_AFM( FT_Face face,
FT_Stream stream );
LOCAL_DEF
void T1_Done_AFM( FT_Memory memory,
T1_AFM* afm );
LOCAL_DEF
void T1_Get_Kerning( T1_AFM* afm,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning );
#ifdef __cplusplus
}
#endif
#endif /* T1AFM_H */
/* END */

View File

@ -1,381 +0,0 @@
/***************************************************************************/
/* */
/* t1driver.c */
/* */
/* Type 1 driver interface (body). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifdef FT_FLAT_COMPILE
#include "t1driver.h"
#include "t1gload.h"
#include "t1afm.h"
#else
#include <type1/t1driver.h>
#include <type1/t1gload.h>
#include <type1/t1afm.h>
#endif
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#include <freetype/internal/psnames.h>
#include <string.h> /* for strcmp() */
/*************************************************************************/
/* */
/* 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_t1driver
#ifndef T1_CONFIG_OPTION_NO_AFM
/*************************************************************************/
/* */
/* <Function> */
/* Get_Kerning */
/* */
/* <Description> */
/* A driver method used to return the kerning vector between two */
/* glyphs of the same face. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* */
/* left_glyph :: The index of the left glyph in the kern pair. */
/* */
/* right_glyph :: The index of the right glyph in the kern pair. */
/* */
/* <Output> */
/* kerning :: The kerning vector. This is in font units for */
/* scalable formats, and in pixels for fixed-sizes */
/* formats. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* Only horizontal layouts (left-to-right & right-to-left) are */
/* supported by this function. Other layouts, or more sophisticated */
/* kernings are out of scope of this method (the basic driver */
/* interface is meant to be simple). */
/* */
/* They can be implemented by format-specific interfaces. */
/* */
static
FT_Error Get_Kerning( T1_Face face,
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning )
{
T1_AFM* afm;
kerning->x = 0;
kerning->y = 0;
afm = (T1_AFM*)face->afm_data;
if ( afm )
T1_Get_Kerning( afm, left_glyph, right_glyph, kerning );
return T1_Err_Ok;
}
#endif /* T1_CONFIG_OPTION_NO_AFM */
static
FT_Error get_t1_glyph_name( T1_Face face,
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{
FT_String* gname;
gname = face->type1.glyph_names[glyph_index];
if ( buffer_max > 0 )
{
FT_UInt len = strlen( gname );
if ( len >= buffer_max )
len = buffer_max - 1;
MEM_Copy( buffer, gname, len );
((FT_Byte*)buffer)[len] = 0;
}
return T1_Err_Ok;
}
static
FT_Module_Interface T1_Get_Interface( FT_Module module,
const char* interface )
{
FT_UNUSED( module );
if ( strcmp( interface, "glyph_name" ) == 0 )
return (FT_Module_Interface)get_t1_glyph_name;
return 0;
}
/*************************************************************************/
/* */
/* <Function> */
/* Set_Char_Sizes */
/* */
/* <Description> */
/* A driver method used to reset a size's character sizes (horizontal */
/* and vertical) expressed in fractional points. */
/* */
/* <Input> */
/* char_width :: The character width expressed in 26.6 */
/* fractional points. */
/* */
/* char_height :: The character height expressed in 26.6 */
/* fractional points. */
/* */
/* horz_resolution :: The horizontal resolution of the output device. */
/* */
/* vert_resolution :: The vertical resolution of the output device. */
/* */
/* <InOut> */
/* size :: A handle to the target size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
static
FT_Error Set_Char_Sizes( T1_Size size,
FT_F26Dot6 char_width,
FT_F26Dot6 char_height,
FT_UInt horz_resolution,
FT_UInt vert_resolution )
{
FT_UNUSED( char_width );
FT_UNUSED( char_height );
FT_UNUSED( horz_resolution );
FT_UNUSED( vert_resolution );
size->valid = FALSE;
return T1_Reset_Size( size );
}
/*************************************************************************/
/* */
/* <Function> */
/* Set_Pixel_Sizes */
/* */
/* <Description> */
/* A driver method used to reset a size's character sizes (horizontal */
/* and vertical) expressed in integer pixels. */
/* */
/* <Input> */
/* pixel_width :: The character width expressed in integer pixels. */
/* */
/* pixel_height :: The character height expressed in integer pixels. */
/* */
/* <InOut> */
/* size :: A handle to the target size object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
static
FT_Error Set_Pixel_Sizes( T1_Size size,
FT_Int pixel_width,
FT_Int pixel_height )
{
FT_UNUSED( pixel_width );
FT_UNUSED( pixel_height );
size->valid = FALSE;
return T1_Reset_Size( size );
}
/*************************************************************************/
/* */
/* <Function> */
/* Get_Char_Index */
/* */
/* <Description> */
/* Uses a charmap to return a given character code's glyph index. */
/* */
/* <Input> */
/* charmap :: A handle to the source charmap object. */
/* charcode :: The character code. */
/* */
/* <Return> */
/* Glyph index. 0 means `undefined character code'. */
/* */
static
FT_UInt Get_Char_Index( FT_CharMap charmap,
FT_Long charcode )
{
T1_Face face;
FT_UInt result = 0;
PSNames_Interface* psnames;
face = (T1_Face)charmap->face;
psnames = (PSNames_Interface*)face->psnames;
if ( psnames )
switch ( charmap->encoding )
{
/*******************************************************************/
/* */
/* Unicode encoding support */
/* */
case ft_encoding_unicode:
/* use the `PSNames' module to synthetize the Unicode charmap */
result = psnames->lookup_unicode( &face->unicode_map,
(FT_ULong)charcode );
/* the function returns 0xFFFF if the Unicode charcode has */
/* no corresponding glyph */
if ( result == 0xFFFF )
result = 0;
goto Exit;
/*******************************************************************/
/* */
/* Custom Type 1 encoding */
/* */
case ft_encoding_adobe_custom:
{
T1_Encoding* encoding = &face->type1.encoding;
if ( charcode >= encoding->code_first &&
charcode <= encoding->code_last )
result = encoding->char_index[charcode];
goto Exit;
}
/*******************************************************************/
/* */
/* Adobe Standard & Expert encoding support */
/* */
default:
if ( charcode < 256 )
{
FT_UInt code;
FT_Int n;
const char* glyph_name;
code = psnames->adobe_std_encoding[charcode];
if ( charmap->encoding == ft_encoding_adobe_expert )
code = psnames->adobe_expert_encoding[charcode];
glyph_name = psnames->adobe_std_strings( code );
if ( !glyph_name )
break;
for ( n = 0; n < face->type1.num_glyphs; n++ )
{
const char* gname = face->type1.glyph_names[n];
if ( gname && gname[0] == glyph_name[0] &&
strcmp( gname, glyph_name ) == 0 )
{
result = n;
break;
}
}
}
}
Exit:
return result;
}
FT_CPLUSPLUS( const FT_Driver_Class ) t1_driver_class =
{
{
ft_module_font_driver | ft_module_driver_scalable,
sizeof( FT_DriverRec ),
"type1", /* driver name */
0x10000L, /* driver version 1.0 */
0x20000L, /* driver requires FreeType 2.0 or above */
0, /* module specific interface */
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) T1_Get_Interface
},
sizeof( T1_FaceRec ),
sizeof( T1_SizeRec ),
sizeof( T1_GlyphSlotRec ),
(FTDriver_initFace) T1_Init_Face,
(FTDriver_doneFace) T1_Done_Face,
(FTDriver_initSize) T1_Init_Size,
(FTDriver_doneSize) T1_Done_Size,
(FTDriver_initGlyphSlot)T1_Init_GlyphSlot,
(FTDriver_doneGlyphSlot)T1_Done_GlyphSlot,
(FTDriver_setCharSizes) Set_Char_Sizes,
(FTDriver_setPixelSizes)Set_Pixel_Sizes,
(FTDriver_loadGlyph) T1_Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index,
#ifdef T1_CONFIG_OPTION_NO_AFM
(FTDriver_getKerning) 0,
(FTDriver_attachFile) 0,
#else
(FTDriver_getKerning) Get_Kerning,
(FTDriver_attachFile) T1_Read_AFM,
#endif
(FTDriver_getAdvances) 0
};
#ifdef FT_CONFIG_OPTION_DYNAMIC_DRIVERS
EXPORT_FUNC( const FT_Driver_Class* ) getDriverClass( void )
{
return &t1_driver_class;
}
#endif /* FT_CONFIG_OPTION_DYNAMIC_DRIVERS */
/* END */

View File

@ -1,40 +0,0 @@
/***************************************************************************/
/* */
/* t1driver.h */
/* */
/* High-level Type 1 driver interface (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1DRIVER_H
#define T1DRIVER_H
#include <freetype/internal/ftdriver.h>
#ifdef __cplusplus
extern "C" {
#endif
FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class;
#ifdef __cplusplus
}
#endif
#endif /* T1DRIVER_H */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,326 +0,0 @@
/***************************************************************************/
/* */
/* t1gload.h */
/* */
/* Type 1 Glyph Loader (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1GLOAD_H
#define T1GLOAD_H
#ifdef FT_FLAT_COMPILE
#include "t1objs.h"
#else
#include <type1/t1objs.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct T1_Builder_ T1_Builder;
typedef FT_Error (*T1_Builder_EndChar)( T1_Builder* loader );
typedef FT_Error (*T1_Builder_Sbw)( T1_Builder* loader,
FT_Pos sbx,
FT_Pos sby,
FT_Pos wx,
FT_Pos wy );
typedef FT_Error (*T1_Builder_ClosePath)( T1_Builder* loader );
typedef FT_Error (*T1_Builder_RLineTo)( T1_Builder* loader,
FT_Pos dx,
FT_Pos dy );
typedef FT_Error (*T1_Builder_RMoveTo)( T1_Builder* loader,
FT_Pos dx,
FT_Pos dy );
typedef FT_Error (*T1_Builder_RCurveTo)( T1_Builder* loader,
FT_Pos dx1,
FT_Pos dy1,
FT_Pos dx2,
FT_Pos dy2,
FT_Pos dx3,
FT_Pos dy3 );
/*************************************************************************/
/* */
/* <Structure> */
/* T1_Builder_Funcs */
/* */
/* <Description> */
/* A structure to store the address of various functions used by a */
/* glyph builder to implement the outline's `path construction'. */
/* */
typedef struct T1_Builder_Funcs_
{
T1_Builder_EndChar end_char;
T1_Builder_Sbw set_bearing_point;
T1_Builder_ClosePath close_path;
T1_Builder_RLineTo rline_to;
T1_Builder_RMoveTo rmove_to;
T1_Builder_RCurveTo rcurve_to;
} T1_Builder_Funcs;
/*************************************************************************/
/* */
/* <Structure> */
/* T1_Builder */
/* */
/* <Description> */
/* A structure used during glyph loading to store its outline. */
/* */
/* <Fields> */
/* memory :: The current memory object. */
/* */
/* face :: The current face object. */
/* */
/* size :: The current size 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. */
/* */
/* pass :: The pass number for multi-pass hinters. */
/* */
/* hint_point :: The index of the next point to hint. */
/* */
/* funcs :: A table of builder functions used to perform the */
/* outline's path construction. */
/* */
struct T1_Builder_
{
FT_Memory memory;
T1_Face face;
T1_Size size;
T1_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_Bool no_recurse;
FT_BBox bbox; /* bounding box */
FT_Bool path_begun;
FT_Bool load_points;
FT_Int pass;
FT_Int hint_point;
/* path construction function interface */
T1_Builder_Funcs funcs;
};
typedef FT_Error (*T1_Hinter_ChangeHints)( T1_Builder* builder );
typedef FT_Error (*T1_Hinter_DotSection)( T1_Builder* builder );
typedef FT_Error (*T1_Hinter_Stem)( T1_Builder* builder,
FT_Pos pos,
FT_Pos width,
FT_Bool vertical );
typedef FT_Error (*T1_Hinter_Stem3)( T1_Builder* builder,
FT_Pos pos0,
FT_Pos width0,
FT_Pos pos1,
FT_Pos width1,
FT_Pos pos2,
FT_Pos width2,
FT_Bool vertical );
/*************************************************************************/
/* */
/* <Structure> */
/* T1_Hinter_Funcs */
/* */
/* <Description> */
/* A structure to store the address of various functions used by a */
/* Type 1 hinter to perform outline hinting. */
/* */
typedef struct T1_Hinter_Func_
{
T1_Hinter_ChangeHints change_hints;
T1_Hinter_DotSection dot_section;
T1_Hinter_Stem stem;
T1_Hinter_Stem3 stem3;
} T1_Hinter_Funcs;
typedef enum T1_Operator_
{
op_none = 0,
op_endchar,
op_hsbw,
op_seac,
op_sbw,
op_closepath,
op_hlineto,
op_hmoveto,
op_hvcurveto,
op_rlineto,
op_rmoveto,
op_rrcurveto,
op_vhcurveto,
op_vlineto,
op_vmoveto,
op_dotsection,
op_hstem,
op_hstem3,
op_vstem,
op_vstem3,
op_div,
op_callothersubr,
op_callsubr,
op_pop,
op_return,
op_setcurrentpoint,
op_max /* never remove this one */
} T1_Operator;
/* execution context charstring zone */
typedef struct T1_Decoder_Zone_
{
FT_Byte* base;
FT_Byte* limit;
FT_Byte* cursor;
} T1_Decoder_Zone;
typedef struct T1_Decoder_
{
T1_Builder builder;
T1_Hinter_Funcs hinter;
FT_Int stack[T1_MAX_CHARSTRINGS_OPERANDS];
FT_Int* top;
T1_Decoder_Zone zones[T1_MAX_SUBRS_CALLS + 1];
T1_Decoder_Zone* zone;
FT_Int flex_state;
FT_Int num_flex_vectors;
FT_Vector flex_vectors[7];
} T1_Decoder;
LOCAL_DEF
void T1_Init_Builder( T1_Builder* builder,
T1_Face face,
T1_Size size,
T1_GlyphSlot glyph,
const T1_Builder_Funcs* funcs );
LOCAL_DEF
void T1_Done_Builder( T1_Builder* builder );
LOCAL_DEF
void T1_Init_Decoder( T1_Decoder* decoder,
const T1_Hinter_Funcs* funcs );
LOCAL_DEF
FT_Error T1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance );
LOCAL_DEF
FT_Error T1_Parse_CharStrings( T1_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 T1_Add_Points( T1_Builder* builder,
FT_Int num_points );
LOCAL_DEF
FT_Error T1_Add_Contours( T1_Builder* builder,
FT_Int num_contours );
LOCAL_DEF
FT_Error T1_Load_Glyph( T1_GlyphSlot glyph,
T1_Size size,
FT_Int glyph_index,
FT_Int load_flags );
#ifdef __cplusplus
}
#endif
#endif /* T1GLOAD_H */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,273 +0,0 @@
/***************************************************************************/
/* */
/* t1hinter.h */
/* */
/* Type 1 hinter (body). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1HINTER_H
#define T1HINTER_H
#ifdef FT_FLAT_COMPILE
#include "t1objs.h"
#include "t1gload.h"
#else
#include <type1/t1objs.h>
#include <type1/t1gload.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Snap_Zone */
/* */
/* <Description> */
/* A `snap zone' is used to model either a blue zone or a stem width */
/* at a given character size. It is made of a minimum and maximum */
/* edge, defined in 26.6 pixels, as well as an `original' and */
/* `scaled' position. */
/* */
/* The position corresponds to the stem width (for stem snap zones) */
/* or to the blue position (for blue zones). */
/* */
/* <Fields> */
/* orus :: The original position in font units. */
/* */
/* pix :: The current position in sub-pixel units. */
/* */
/* min :: The minimum boundary in sub-pixel units. */
/* */
/* max :: The maximum boundary in sub-pixel units. */
/* */
typedef struct T1_Snap_Zone_
{
FT_Pos orus;
FT_Pos pix;
FT_Pos min;
FT_Pos max;
} T1_Snap_Zone;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Edge */
/* */
/* <Description> */
/* A very simple structure used to model a stem edge. */
/* */
/* <Fields> */
/* orus :: The original edge position in font units. */
/* */
/* pix :: The scaled edge position in sub-pixel units. */
/* */
typedef struct T1_Edge_
{
FT_Pos orus;
FT_Pos pix;
} T1_Edge;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Stem_Hint */
/* */
/* <Description> */
/* A simple structure used to model a stem hint. */
/* */
/* <Fields> */
/* min_edge :: The hint's minimum edge. */
/* */
/* max_edge :: The hint's maximum edge. */
/* */
/* hint_flags :: Some flags describing the stem properties. */
/* */
/* <Note> */
/* The min and max edges of a ghost stem have the same position, even */
/* if they are coded in a weird way in the charstrings. */
/* */
typedef struct T1_Stem_Hint_
{
T1_Edge min_edge;
T1_Edge max_edge;
FT_Int hint_flags;
} T1_Stem_Hint;
#define T1_HINT_FLAG_ACTIVE 1 /* indicates an active stem */
#define T1_HINT_FLAG_MIN_BORDER 2 /* unused for now */
#define T1_HINT_FLAG_MAX_BORDER 4 /* unused for now */
/* hinter's configuration constants */
#define T1_HINTER_MAX_BLUES 24 /* maximum number of blue zones */
#define T1_HINTER_MAX_SNAPS 16 /* maximum number of stem snap zones */
#define T1_HINTER_MAX_EDGES 64 /* maximum number of stem hints */
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Size_Hints */
/* */
/* <Description> */
/* A structure used to model the hinting information related to a size */
/* object. */
/* */
/* <Fields> */
/* supress_overshoots :: A boolean flag to tell whether overshoot */
/* supression should occur. */
/* */
/* num_blue_zones :: The total number of blue zones (top+bottom). */
/* */
/* num_bottom_zones :: The number of bottom zones. */
/* */
/* blue_zones :: The blue zones table. Bottom zones are */
/* stored first in the table, followed by all */
/* top zones. */
/* */
/* num_snap_widths :: The number of horizontal stem snap zones. */
/* */
/* snap_widths :: An array of horizontal stem snap zones. */
/* */
/* num_snap_heights :: The number of vertical stem snap zones. */
/* */
/* snap_heights :: An array of vertical stem snap zones. */
/* */
struct T1_Size_Hints_
{
FT_Bool supress_overshoots;
FT_Int num_blue_zones;
FT_Int num_bottom_zones;
T1_Snap_Zone blue_zones[T1_HINTER_MAX_BLUES];
FT_Int num_snap_widths;
T1_Snap_Zone snap_widths[T1_HINTER_MAX_SNAPS];
FT_Int num_snap_heights;
T1_Snap_Zone snap_heights[T1_HINTER_MAX_SNAPS];
};
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Stem_Table */
/* */
/* <Description> */
/* A simple structure used to model a set of stem hints in a single */
/* direction during the loading of a given glyph outline. Not all */
/* stem hints are active at a time. Moreover, stems must be sorted */
/* regularly. */
/* */
/* <Fields> */
/* num_stems :: The total number of stems in the table. */
/* */
/* num_active :: The number of active stems in the table. */
/* */
/* stems :: A table of all stems. */
/* */
/* sort :: A table of indices into the stems table, used to */
/* keep a sorted list of the active stems. */
/* */
typedef struct T1_Stem_Table_
{
FT_Int num_stems;
FT_Int num_active;
T1_Stem_Hint stems[T1_HINTER_MAX_EDGES];
FT_Int sort [T1_HINTER_MAX_EDGES];
} T1_Stem_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Glyph_Hints */
/* */
/* <Description> */
/* A structure used to model the stem hints of a given glyph outline */
/* during glyph loading. */
/* */
/* <Fields> */
/* hori_stems :: The horizontal stem hints table. */
/* vert_stems :: The vertical stem hints table. */
/* */
struct T1_Glyph_Hints_
{
T1_Stem_Table hori_stems;
T1_Stem_Table vert_stems;
};
/*************************************************************************/
/* */
/* <Data> */
/* t1_hinter_funcs */
/* */
/* <Description> */
/* A table containing the address of various functions used during */
/* the loading of an hinted scaled outline. */
/* */
extern const T1_Hinter_Funcs t1_hinter_funcs;
LOCAL_DEF
FT_Error T1_New_Size_Hinter( T1_Size size );
LOCAL_DEF
void T1_Done_Size_Hinter( T1_Size size );
LOCAL_DEF
FT_Error T1_Reset_Size_Hinter( T1_Size size );
LOCAL_DEF
FT_Error T1_New_Glyph_Hinter( T1_GlyphSlot glyph );
LOCAL_DEF
void T1_Done_Glyph_Hinter( T1_GlyphSlot glyph );
LOCAL_DEF
void T1_Hint_Points( T1_Builder* builder );
LOCAL_DEF
void T1_Hint_Stems( T1_Builder* builder );
#ifdef __cplusplus
}
#endif
#endif /* T1HINTER_H */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,57 +0,0 @@
/***************************************************************************/
/* */
/* t1load.h */
/* */
/* Type 1 font loader (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1LOAD_H
#define T1LOAD_H
#include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE
#include "t1parse.h"
#else
#include <type1/t1parse.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
LOCAL_DEF
void Init_T1_Parser( T1_Parser* parser,
T1_Face face,
T1_Tokenizer tokenizer );
LOCAL_DEF
FT_Error Parse_T1_FontProgram( T1_Parser* parser );
#ifdef __cplusplus
}
#endif
#endif /* T1LOAD_H */
/* END */

View File

@ -1,544 +0,0 @@
/***************************************************************************/
/* */
/* t1objs.c */
/* */
/* Type 1 objects manager (body). */
/* */
/* 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. */
/* */
/***************************************************************************/
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE
#include "t1gload.h"
#include "t1load.h"
#include "t1afm.h"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include "t1hinter.h"
#endif
#else /* FT_FLAT_COMPILE */
#include <type1/t1gload.h>
#include <type1/t1load.h>
#include <type1/t1afm.h>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.h>
#endif
#endif /* FT_FLAT_COMPILE */
#include <freetype/internal/psnames.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_t1objs
/*************************************************************************/
/* */
/* SIZE FUNCTIONS */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* T1_Done_Size */
/* */
/* <Description> */
/* The Type 1 size object destructor. Used to discard a given size */
/* object. */
/* */
/* <Input> */
/* size :: A handle to the target size object. */
/* */
LOCAL_FUNC
void T1_Done_Size( T1_Size size )
{
if ( size )
{
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
T1_Done_Size_Hinter( size );
#endif
size->valid = 0;
}
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Init_Size */
/* */
/* <Description> */
/* The size object initializer. */
/* */
/* <Input> */
/* size :: A handle to the target size object. */
/* */
/* <Return> */
/* FreeTrue error code. 0 means success. */
/* */
LOCAL_DEF
FT_Error T1_Init_Size( T1_Size size )
{
FT_Error error;
size->valid = 0;
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
error = T1_New_Size_Hinter( size );
return error;
#else
FT_UNUSED( error );
return T1_Err_Ok;
#endif
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Reset_Size */
/* */
/* <Description> */
/* Resets an instance to a new pointsize/transform. This function is */
/* in charge of resetting the blue zones,a s well as the stem snap */
/* tables for a given size. */
/* */
/* <Input> */
/* size :: The target size object. */
/* */
/* <Output> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
FT_Error T1_Reset_Size( T1_Size size )
{
/* recompute ascender, descender, etc. */
T1_Face face = (T1_Face)size->root.face;
FT_Size_Metrics* metrics = &size->root.metrics;
if ( metrics->x_ppem < 1 || metrics->y_ppem < 1 )
return FT_Err_Invalid_Argument;
/* Compute root ascender, descender, test height, and max_advance */
metrics->ascender = ( FT_MulFix( face->root.ascender,
metrics->y_scale ) + 32 ) & -64;
metrics->descender = ( FT_MulFix( face->root.descender,
metrics->y_scale ) + 32 ) & -64;
metrics->height = ( FT_MulFix( face->root.height,
metrics->y_scale ) + 32 ) & -64;
metrics->max_advance = ( FT_MulFix( face->root.max_advance_width,
metrics->x_scale ) + 32 ) & -64;
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
return T1_Reset_Size_Hinter( size );
#else
return 0;
#endif
}
/*************************************************************************/
/* */
/* FACE FUNCTIONS */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Function> */
/* T1_Done_Face */
/* */
/* <Description> */
/* The face object destructor. */
/* */
/* <Input> */
/* face :: A typeless pointer to the face object to destroy. */
/* */
LOCAL_FUNC
void T1_Done_Face( T1_Face face )
{
FT_Memory memory;
T1_Font* type1 = &face->type1;
if ( face )
{
memory = face->root.memory;
/* release font info strings */
{
T1_FontInfo* info = &type1->font_info;
FREE( info->version );
FREE( info->notice );
FREE( info->full_name );
FREE( info->family_name );
FREE( info->weight );
}
/* release top dictionary */
FREE( type1->charstrings_len );
FREE( type1->charstrings );
FREE( type1->glyph_names );
FREE( type1->subrs );
FREE( type1->subrs_len );
FREE( type1->subrs_block );
FREE( type1->charstrings_block );
FREE( type1->glyph_names_block );
FREE( type1->encoding.char_index );
FREE( type1->font_name );
#ifndef T1_CONFIG_OPTION_NO_AFM
/* release afm data if present */
if ( face->afm_data )
T1_Done_AFM( memory, (T1_AFM*)face->afm_data );
#endif
/* release unicode map, if any */
FREE( face->unicode_map.maps );
face->unicode_map.num_maps = 0;
face->root.family_name = 0;
face->root.style_name = 0;
}
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Init_Face */
/* */
/* <Description> */
/* The face object constructor. */
/* */
/* <Input> */
/* stream :: input stream where to load font data. */
/* */
/* face_index :: The index of the font face in the resource. */
/* */
/* num_params :: Number of additional generic parameters. Ignored. */
/* */
/* params :: Additional generic parameters. Ignored. */
/* */
/* <InOut> */
/* face :: The face record to build. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
FT_Error T1_Init_Face( FT_Stream stream,
T1_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
T1_Tokenizer tokenizer;
FT_Error error;
PSNames_Interface* psnames;
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
FT_UNUSED( face );
face->root.num_faces = 1;
psnames = (PSNames_Interface*)face->psnames;
if ( !psnames )
{
psnames = (PSNames_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
"psnames" );
face->psnames = psnames;
}
/* open the tokenizer, this will also check the font format */
error = New_Tokenizer( stream, &tokenizer );
if ( error )
goto Fail;
/* if we just wanted to check the format, leave successfully now */
if ( face_index < 0 )
goto Leave;
/* check the face index */
if ( face_index != 0 )
{
FT_ERROR(( "T1_Init_Face: invalid face index\n" ));
error = T1_Err_Invalid_Argument;
goto Leave;
}
/* Now, load the font program into the face object */
{
T1_Parser parser;
Init_T1_Parser( &parser, face, tokenizer );
error = Parse_T1_FontProgram( &parser );
if ( error )
goto Leave;
/* Init the face object fields */
/* Now set up root face fields */
{
FT_Face root = (FT_Face)&face->root;
T1_Font* type1 = &face->type1;
root->num_glyphs = type1->num_glyphs;
root->num_charmaps = 1;
root->face_index = face_index;
root->face_flags = FT_FACE_FLAG_SCALABLE;
root->face_flags |= FT_FACE_FLAG_HORIZONTAL;
root->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
if ( type1->font_info.is_fixed_pitch )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: TODO -- add kerning with .afm support */
/* get style name - be careful, some broken fonts only */
/* have a `/FontName' dictionary entry! */
root->family_name = type1->font_info.family_name;
if ( root->family_name )
{
char* full = type1->font_info.full_name;
char* family = root->family_name;
while ( *family && *full == *family )
{
family++;
full++;
}
root->style_name = ( *full == ' ' ? full + 1
: (char *)"Regular" );
}
else
{
/* do we have a `/FontName'? */
if (type1->font_name)
{
root->family_name = type1->font_name;
root->style_name = "Regular";
}
}
/* no embedded bitmap support */
root->num_fixed_sizes = 0;
root->available_sizes = 0;
root->bbox = type1->font_bbox;
root->units_per_EM = 1000;
root->ascender = (FT_Short)type1->font_bbox.yMax;
root->descender = -(FT_Short)type1->font_bbox.yMin;
root->height = ( ( root->ascender + root->descender) * 12 )
/ 10;
/* now compute the maximum advance width */
root->max_advance_width = type1->private_dict.standard_width[0];
/* compute max advance width for proportional fonts */
if ( !type1->font_info.is_fixed_pitch )
{
FT_Int max_advance;
error = T1_Compute_Max_Advance( face, &max_advance );
/* in case of error, keep the standard width */
if ( !error )
root->max_advance_width = max_advance;
else
error = 0; /* clear error */
}
root->max_advance_height = root->height;
root->underline_position = type1->font_info.underline_position;
root->underline_thickness = type1->font_info.underline_thickness;
root->max_points = 0;
root->max_contours = 0;
}
}
/* charmap support - synthetize unicode charmap when possible */
{
FT_Face root = &face->root;
FT_CharMap charmap = face->charmaprecs;
/* synthesize a Unicode charmap if there is support in the `PSNames' */
/* module.. */
if ( face->psnames )
{
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
if ( psnames->unicode_value )
{
error = psnames->build_unicodes(
root->memory,
face->type1.num_glyphs,
(const char**)face->type1.glyph_names,
&face->unicode_map );
if ( !error )
{
root->charmap = charmap;
charmap->face = (FT_Face)face;
charmap->encoding = ft_encoding_unicode;
charmap->platform_id = 3;
charmap->encoding_id = 1;
charmap++;
}
/* simply clear the error in case of failure (which really) */
/* means that out of memory or no unicode glyph names */
error = 0;
}
}
/* now, support either the standard, expert, or custom encodings */
charmap->face = (FT_Face)face;
charmap->platform_id = 7; /* a new platform id for Adobe fonts ?? */
switch ( face->type1.encoding_type )
{
case t1_encoding_standard:
charmap->encoding = ft_encoding_adobe_standard;
charmap->encoding_id = 0;
break;
case t1_encoding_expert:
charmap->encoding = ft_encoding_adobe_expert;
charmap->encoding_id = 1;
break;
default:
charmap->encoding = ft_encoding_adobe_custom;
charmap->encoding_id = 2;
break;
}
root->charmaps = face->charmaps;
root->num_charmaps = charmap - face->charmaprecs + 1;
face->charmaps[0] = &face->charmaprecs[0];
face->charmaps[1] = &face->charmaprecs[1];
}
Leave:
Done_Tokenizer( tokenizer );
Fail:
return error;
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Done_GlyphSlot */
/* */
/* <Description> */
/* The glyph slot object destructor. */
/* */
/* <Input> */
/* glyph :: The glyph slot handle to destroy. */
/* */
LOCAL_FUNC
void T1_Done_GlyphSlot( T1_GlyphSlot glyph )
{
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
T1_Done_Glyph_Hinter( glyph );
#else
FT_UNUSED( glyph );
#endif
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Init_GlyphSlot */
/* */
/* <Description> */
/* The glyph slot object constructor. */
/* */
/* <Input> */
/* glyph :: The glyph slot handle to initialize. */
/* */
LOCAL_FUNC
FT_Error T1_Init_GlyphSlot( T1_GlyphSlot glyph )
{
FT_Error error = FT_Err_Ok;
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
error = T1_New_Glyph_Hinter( glyph );
#else
FT_UNUSED( glyph );
#endif
return error;
}
/* END */

View File

@ -1,172 +0,0 @@
/***************************************************************************/
/* */
/* t1objs.h */
/* */
/* Type 1 objects manager (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1OBJS_H
#define T1OBJS_H
#include <freetype/config/ftconfig.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/t1types.h>
#include <freetype/internal/t1errors.h>
#ifdef __cplusplus
extern "C" {
#endif
/* The following structures must be defined by the hinter */
typedef struct T1_Size_Hints_ T1_Size_Hints;
typedef struct T1_Glyph_Hints_ T1_Glyph_Hints;
/*************************************************************************/
/* */
/* <Type> */
/* T1_Driver */
/* */
/* <Description> */
/* A handle to a Type 1 driver object. */
/* */
typedef struct T1_DriverRec_* T1_Driver;
/*************************************************************************/
/* */
/* <Type> */
/* T1_Size */
/* */
/* <Description> */
/* A handle to a Type 1 size object. */
/* */
typedef struct T1_SizeRec_* T1_Size;
/*************************************************************************/
/* */
/* <Type> */
/* T1_GlyphSlot */
/* */
/* <Description> */
/* A handle to a Type 1 glyph slot object. */
/* */
typedef struct T1_GlyphSlotRec_* T1_GlyphSlot;
/*************************************************************************/
/* */
/* <Type> */
/* T1_CharMap */
/* */
/* <Description> */
/* A handle to a Type 1 character mapping object. */
/* */
/* <Note> */
/* The Type 1 format doesn't use a charmap but an encoding table. */
/* The driver is responsible for making up charmap objects */
/* corresponding to these tables. */
/* */
typedef struct T1_CharMapRec_* T1_CharMap;
/*************************************************************************/
/* */
/* HERE BEGINS THE TYPE1 SPECIFIC STUFF */
/* */
/*************************************************************************/
/*************************************************************************/
/* */
/* <Type> */
/* T1_SizeRec */
/* */
/* <Description> */
/* Type 1 size record. */
/* */
typedef struct T1_SizeRec_
{
FT_SizeRec root;
FT_Bool valid;
T1_Size_Hints* hints; /* defined in the hinter. This allows */
/* us to experiment with different */
/* hinting schemes without having to */
/* change `t1objs' each time. */
} T1_SizeRec;
/*************************************************************************/
/* */
/* <Type> */
/* T1_GlyphSlotRec */
/* */
/* <Description> */
/* Type 1 glyph slot record. */
/* */
typedef struct T1_GlyphSlotRec_
{
FT_GlyphSlotRec root;
FT_Bool hint;
FT_Bool scaled;
FT_Int max_points;
FT_Int max_contours;
FT_Fixed x_scale;
FT_Fixed y_scale;
T1_Glyph_Hints* hints; /* defined in the hinter */
} T1_GlyphSlotRec;
LOCAL_DEF
FT_Error T1_Init_Face( FT_Stream stream,
T1_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
LOCAL_DEF
void T1_Done_Face( T1_Face face );
LOCAL_DEF
FT_Error T1_Init_Size( T1_Size size );
LOCAL_DEF
void T1_Done_Size( T1_Size size );
LOCAL_DEF
FT_Error T1_Reset_Size( T1_Size size );
LOCAL_DEF
FT_Error T1_Init_GlyphSlot( T1_GlyphSlot slot );
LOCAL_DEF
void T1_Done_GlyphSlot( T1_GlyphSlot slot );
#ifdef __cplusplus
}
#endif
#endif /* T1OBJS_H */
/* END */

View File

@ -1,761 +0,0 @@
/***************************************************************************/
/* */
/* t1parse.c */
/* */
/* Type 1 parser (body). */
/* */
/* 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. */
/* */
/***************************************************************************/
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/t1types.h>
#ifdef FT_FLAT_COMPILE
#include "t1parse.h"
#else
#include <type1/t1parse.h>
#endif
#include <stdio.h> /* for sscanf() */
#include <string.h> /* for strncpy() */
/*************************************************************************/
/* */
/* <Function> */
/* T1_New_Table */
/* */
/* <Description> */
/* Initializes a T1_Table structure. */
/* */
/* <InOut> */
/* table :: The address of the target table. */
/* */
/* <Input> */
/* count :: The table size (i.e. maximum number of elements). */
/* memory :: The memory object to use for all subsequent */
/* reallocations. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
FT_Error T1_New_Table( T1_Table* table,
FT_Int count,
FT_Memory memory )
{
FT_Error error;
table->memory = memory;
if ( ALLOC_ARRAY( table->elements, count, FT_Byte* ) )
return error;
if ( ALLOC_ARRAY( table->lengths, count, FT_Byte* ) )
{
FREE( table->elements );
return error;
}
table->max_elems = count;
table->num_elems = 0;
table->block = 0;
table->capacity = 0;
table->cursor = 0;
return error;
}
static
FT_Error reallocate_t1_table( T1_Table* table,
FT_Int new_size )
{
FT_Memory memory = table->memory;
FT_Byte* old_base = table->block;
FT_Error error;
/* reallocate the base block */
if ( REALLOC( table->block, table->capacity, new_size ) )
return error;
table->capacity = new_size;
/* shift all offsets if necessary */
if ( old_base )
{
FT_Long delta = table->block - old_base;
FT_Byte** offset = table->elements;
FT_Byte** limit = offset + table->max_elems;
if ( delta )
for ( ; offset < limit; offset ++ )
if (offset[0])
offset[0] += delta;
}
return T1_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Add_Table */
/* */
/* <Description> */
/* Adds an object to a T1_Table, possibly growing its memory block. */
/* */
/* <InOut> */
/* table :: The target table. */
/* */
/* <Input> */
/* index :: The index of the object in the table. */
/* */
/* object :: The address of the object to copy in memory. */
/* */
/* length :: The length in bytes of the source object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. An error is returned if a */
/* reallocation failed. */
/* */
LOCAL_FUNC
FT_Error T1_Add_Table( T1_Table* table,
FT_Int index,
void* object,
FT_Int length )
{
if ( index < 0 || index > table->max_elems )
{
FT_ERROR(( "T1_Add_Table: invalid index\n" ));
return T1_Err_Syntax_Error;
}
/* grow the base block if needed */
if ( table->cursor + length > table->capacity )
{
FT_Error error;
FT_Int new_size = table->capacity;
while ( new_size < table->cursor + length )
new_size += 1024;
error = reallocate_t1_table( table, new_size );
if ( error )
return error;
}
/* add the object to the base block and adjust offset */
table->elements[index] = table->block + table->cursor;
table->lengths [index] = length;
MEM_Copy( table->block + table->cursor, object, length );
table->cursor += length;
return T1_Err_Ok;
}
/*************************************************************************/
/* */
/* <Function> */
/* T1_Done_Table */
/* */
/* <Description> */
/* Finalize a T1_Table (reallocate it to its current cursor). */
/* */
/* <Input> */
/* table :: The target table. */
/* */
/* <Note> */
/* This function does NOT release the heap's memory block. It is up */
/* to the caller to clean it, or reference it in its own structures. */
/* */
LOCAL_FUNC
void T1_Done_Table( T1_Table* table )
{
FT_Memory memory = table->memory;
FT_Error error;
FT_Byte* old_base;
/* should never fail, as rec.cursor <= rec.size */
old_base = table->block;
if ( !old_base )
return;
(void)REALLOC( table->block, table->capacity, table->cursor );
table->capacity = table->cursor;
if ( old_base != table->block )
{
FT_Long delta = table->block - old_base;
FT_Byte** element = table->elements;
FT_Byte** limit = element + table->max_elems;
for ( ; element < limit; element++ )
if ( element[0] )
element[0] += delta;
}
}
LOCAL_FUNC
FT_String* CopyString( T1_Parser* parser )
{
FT_String* string = NULL;
T1_Token* token = parser->args++;
FT_Memory memory = parser->tokenizer->memory;
FT_Error error;
if ( token->kind == tok_string )
{
FT_Int len = token->len - 2;
if ( ALLOC( string, len + 1 ) )
{
parser->error = error;
return 0;
}
MEM_Copy( string, parser->tokenizer->base + token->start + 1, len );
string[len] = '\0';
parser->error = T1_Err_Ok;
}
else
{
FT_ERROR(( "T1_CopyString: syntax error, string token expected!\n" ));
parser->error = T1_Err_Syntax_Error;
}
return string;
}
static
FT_Error parse_int( FT_Byte* base,
FT_Byte* limit,
FT_Long* result )
{
FT_Bool sign = 0;
FT_Long sum = 0;
if ( base >= limit )
goto Fail;
/* check sign */
if ( *base == '+' )
base++;
else if ( *base == '-' )
{
sign++;
base++;
}
/* parse digits */
if ( base >= limit )
goto Fail;
do
{
sum = ( 10 * sum + ( *base++ - '0' ) );
} while ( base < limit );
if ( sign )
sum = -sum;
*result = sum;
return T1_Err_Ok;
Fail:
FT_ERROR(( "parse_int: integer expected\n" ));
*result = 0;
return T1_Err_Syntax_Error;
}
static
FT_Error parse_float( FT_Byte* base,
FT_Byte* limit,
FT_Long scale,
FT_Long* result )
{
#if 1
/* XXX: We are simply much too lazy to code this function */
/* properly for now. We will do that when the rest of */
/* the driver works properly. */
char temp[32];
int len = limit - base;
double value;
if ( len > 31 )
goto Fail;
strncpy( temp, (char*)base, len );
temp[len] = '\0';
if ( sscanf( temp, "%lf", &value ) != 1 )
goto Fail;
*result = (FT_Long)( scale * value );
return 0;
#else
FT_Byte* cur;
FT_Bool sign = 0; /* sign */
FT_Long number_int = 0; /* integer part */
FT_Long number_frac = 0; /* fractional part */
FT_Long exponent = 0; /* exponent value */
FT_Int num_frac = 0; /* number of fractional digits */
/* check sign */
if ( *base == '+' )
base++;
else if ( *base == '-' )
{
sign++;
base++;
}
/* find integer part */
cur = base;
while ( cur < limit )
{
FT_Byte c = *cur;
if ( c == '.' || c == 'e' || c == 'E' )
break;
cur++;
}
if ( cur > base )
{
error = parse_integer( base, cur, &number_int );
if ( error )
goto Fail;
}
/* read fractional part, if any */
if ( *cur == '.' )
{
cur++;
base = cur;
while ( cur < limit )
{
FT_Byte c = *cur;
if ( c == 'e' || c == 'E' )
break;
cur++;
}
num_frac = cur - base;
if ( cur > base )
{
error = parse_integer( base, cur, &number_frac );
if ( error )
goto Fail;
base = cur;
}
}
/* read exponent, if any */
if ( *cur == 'e' || *cur == 'E' )
{
cur++;
base = cur;
error = parse_integer( base, limit, &exponent );
if ( error )
goto Fail;
/* now check that exponent is within `correct bounds' */
/* i.e. between -6 and 6 */
if ( exponent < -6 || exponent > 6 )
goto Fail;
}
/* now adjust integer value and exponent for fractional part */
while ( num_frac > 0 )
{
number_int *= 10;
exponent--;
num_frac--;
}
number_int += num_frac;
/* skip point if any, read fractional part */
if ( cur + 1 < limit )
{
if (*cur..
}
/* now compute scaled float value */
/* XXX: incomplete! */
#endif /* 1 */
Fail:
FT_ERROR(( "parse_float: syntax error!\n" ));
return T1_Err_Syntax_Error;
}
static
FT_Error parse_integer( FT_Byte* base,
FT_Byte* limit,
FT_Long* result )
{
FT_Byte* cur;
/* the lexical analyser accepts floats as well as integers */
/* now; check that we really have an int in this token */
cur = base;
while ( cur < limit )
{
FT_Byte c = *cur++;
if ( c == '.' || c == 'e' || c == 'E' )
goto Float_Number;
}
/* now read the number's value */
return parse_int( base, limit, result );
Float_Number:
/* we really have a float there; simply call parse_float in this */
/* case with a scale of `10' to perform round */
{
FT_Error error;
error = parse_float( base, limit, 10, result );
if ( !error )
{
if ( *result >= 0 )
*result = ( *result + 5 ) / 10; /* round value */
else
*result = -( ( 5 - *result ) / 10 );
}
return error;
}
}
LOCAL_FUNC
FT_Long CopyInteger( T1_Parser* parser )
{
FT_Long sum = 0;
T1_Token* token = parser->args++;
if ( token->kind == tok_number )
{
FT_Byte* base = parser->tokenizer->base + token->start;
FT_Byte* limit = base + token->len;
/* now read the number's value */
parser->error = parse_integer( base, limit, &sum );
return sum;
}
FT_ERROR(( "CopyInteger: number expected\n" ));
parser->args--;
parser->error = T1_Err_Syntax_Error;
return 0;
}
LOCAL_FUNC
FT_Bool CopyBoolean( T1_Parser* parser )
{
FT_Error error = T1_Err_Ok;
FT_Bool result = 0;
T1_Token* token = parser->args++;
if ( token->kind == tok_keyword )
{
if ( token->kind2 == key_false )
result = 0;
else if ( token->kind2 == key_true )
result = !0;
else
goto Fail;
}
else
{
Fail:
FT_ERROR(( "CopyBoolean:" ));
FT_ERROR(( " syntax error; `false' or `true' expected\n" ));
error = T1_Err_Syntax_Error;
}
parser->error = error;
return result;
}
LOCAL_FUNC
FT_Long CopyFloat( T1_Parser* parser,
FT_Int scale )
{
FT_Error error;
FT_Long sum = 0;
T1_Token* token = parser->args++;
if ( token->kind == tok_number )
{
FT_Byte* base = parser->tokenizer->base + token->start;
FT_Byte* limit = base + token->len;
error = parser->error = parse_float( base, limit, scale, &sum );
if ( error )
goto Fail;
return sum;
}
Fail:
FT_ERROR(( "CopyFloat: syntax error!\n" ));
parser->error = T1_Err_Syntax_Error;
return 0;
}
LOCAL_FUNC
void CopyBBox( T1_Parser* parser,
FT_BBox* bbox )
{
T1_Token* token = parser->args++;
FT_Int n;
FT_Error error;
if ( token->kind == tok_program ||
token->kind == tok_array )
{
/* get rid of `['/`]', or `{'/`}' */
FT_Byte* base = parser->tokenizer->base + token->start + 1;
FT_Byte* limit = base + token->len - 2;
FT_Byte* cur;
FT_Byte* start;
/* read each parameter independently */
cur = base;
for ( n = 0; n < 4; n++ )
{
FT_Long* result;
/* skip whitespace */
while ( cur < limit && *cur == ' ' )
cur++;
/* skip numbers */
start = cur;
while ( cur < limit && *cur != ' ' )
cur++;
/* compute result address */
switch ( n )
{
case 0:
result = &bbox->xMin;
break;
case 1:
result = &bbox->yMin;
break;
case 2:
result = &bbox->xMax;
break;
default:
result = &bbox->yMax;
}
error = parse_integer( start, cur, result );
if ( error )
goto Fail;
}
parser->error = 0;
return;
}
Fail:
FT_ERROR(( "CopyBBox: syntax error!\n" ));
parser->error = T1_Err_Syntax_Error;
}
LOCAL_FUNC
void CopyMatrix( T1_Parser* parser,
FT_Matrix* matrix )
{
T1_Token* token = parser->args++;
FT_Error error;
if ( token->kind == tok_array )
{
/* get rid of `[' and `]' */
FT_Byte* base = parser->tokenizer->base + token->start + 1;
FT_Byte* limit = base + token->len - 2;
FT_Byte* cur;
FT_Byte* start;
FT_Int n;
/* read each parameter independently */
cur = base;
for ( n = 0; n < 4; n++ )
{
FT_Long* result;
/* skip whitespace */
while ( cur < limit && *cur == ' ' )
cur++;
/* skip numbers */
start = cur;
while ( cur < limit && *cur != ' ')
cur++;
/* compute result address */
switch ( n )
{
case 0:
result = &matrix->xx;
break;
case 1:
result = &matrix->yx;
break;
case 2:
result = &matrix->xy;
break;
default:
result = &matrix->yy;
}
error = parse_float( start, cur, 65536000L, result );
if ( error )
goto Fail;
}
parser->error = 0;
return;
}
Fail:
FT_ERROR(( "CopyMatrix: syntax error!\n" ));
parser->error = T1_Err_Syntax_Error;
}
LOCAL_FUNC
void CopyArray( T1_Parser* parser,
FT_Byte* num_elements,
FT_Short* elements,
FT_Int max_elements )
{
T1_Token* token = parser->args++;
FT_Error error;
if ( token->kind == tok_array ||
token->kind == tok_program ) /* in the case of MinFeature */
{
/* get rid of `['/`]', or `{'/`}' */
FT_Byte* base = parser->tokenizer->base + token->start + 1;
FT_Byte* limit = base + token->len - 2;
FT_Byte* cur;
FT_Byte* start;
FT_Int n;
/* read each parameter independently */
cur = base;
for ( n = 0; n < max_elements; n++ )
{
FT_Long result;
/* test end of string */
if ( cur >= limit )
break;
/* skip whitespace */
while ( cur < limit && *cur == ' ' )
cur++;
/* end of list? */
if ( cur >= limit )
break;
/* skip numbers */
start = cur;
while ( cur < limit && *cur != ' ' )
cur++;
error = parse_integer( start, cur, &result );
if ( error )
goto Fail;
*elements++ = (FT_Short)result;
}
if ( num_elements )
*num_elements = (FT_Byte)n;
parser->error = 0;
return;
}
Fail:
FT_ERROR(( "CopyArray: syntax error!\n" ));
parser->error = T1_Err_Syntax_Error;
}
/* END */

View File

@ -1,261 +0,0 @@
/***************************************************************************/
/* */
/* t1parse.h */
/* */
/* Type 1 parser (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
/*************************************************************************/
/* */
/* The Type1 parser component is in charge of simply parsing the font */
/* input stream and convert simple tokens and elements into integers, */
/* floats, matrices, strings, etc. */
/* */
/* It is used by the Type1 loader. */
/* */
/*************************************************************************/
#ifndef T1PARSE_H
#define T1PARSE_H
#include <freetype/internal/ftstream.h>
#ifdef FT_FLAT_COMPILE
#include "t1tokens.h"
#else
#include <type1/t1tokens.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************/
/* */
/* <Enum> */
/* T1_DictState */
/* */
/* <Description> */
/* An enumeration used to describe the Type 1 parser's state, i.e. */
/* which dictionary (or array) it is scanning and processing at the */
/* current moment. */
/* */
typedef enum T1_DictState_
{
dict_none = 0,
dict_font, /* parsing the font dictionary */
dict_fontinfo, /* parsing the font info dictionary */
dict_none2, /* beginning to parse the encrypted section */
dict_private, /* parsing the private dictionary */
dict_encoding, /* parsing the encoding array */
dict_subrs, /* parsing the subrs array */
dict_othersubrs, /* parsing the othersubrs array (?) */
dict_charstrings, /* parsing the charstrings dictionary */
dict_unknown_array, /* parsing/ignoring an unknown array */
dict_unknown_dict, /* parsing/ignoring an unknown dictionary */
dict_max /* do not remove from list */
} T1_DictState;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Table */
/* */
/* <Description> */
/* A T1_Table is a simple object used to store an array of objects in */
/* a single memory block. */
/* */
/* <Fields> */
/* block :: The address in memory of the growheap's block. This */
/* can change between two object adds, due to */
/* reallocation. */
/* */
/* cursor :: The current top of the grow heap within its block. */
/* */
/* capacity :: The current size of the heap block. Increments by */
/* 1kByte chunks. */
/* */
/* max_elems :: The maximum number of elements in table. */
/* */
/* num_elems :: The current number of elements in table. */
/* */
/* elements :: A table of element addresses within the block. */
/* */
/* lengths :: A table of element sizes within the block. */
/* */
/* memory :: The object used for memory operations */
/* (alloc/realloc). */
/* */
typedef struct T1_Table_
{
FT_Byte* block; /* current memory block */
FT_Int cursor; /* current cursor in memory block */
FT_Int capacity; /* current size of memory block */
FT_Int max_elems;
FT_Int num_elems;
FT_Byte** elements; /* addresses of table elements */
FT_Int* lengths; /* lengths of table elements */
FT_Memory memory;
} T1_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Parser */
/* */
/* <Description> */
/* A Type 1 parser. This object is in charge of parsing Type 1 ASCII */
/* streams and builds dictionaries for a T1_Face object. */
/* */
/* <Fields> */
/* error :: The current error code. 0 means success. */
/* */
/* face :: The target T1_Face object being built. */
/* */
/* tokenizer :: The tokenizer (lexical analyser) used for */
/* processing the input stream. */
/* */
/* dump_tokens :: XXX */
/* */
/* stack :: The current token stack. Note that we don't */
/* use intermediate Postscript objects here! */
/* */
/* top :: The current top of token stack. */
/* */
/* limit :: The current upper bound of the token stack. */
/* Used for overflow checks. */
/* */
/* args :: The arguments of a given operator. Used and */
/* increased by the various CopyXXX() functions. */
/* */
/* state_index :: The index of the top of the dictionary state */
/* stack. */
/* */
/* state_stack :: The dictionary states stack. */
/* */
/* table :: A T1_Table object used to record various kinds */
/* of dictionaries or arrays (like `/Encoding', */
/* `/Subrs', `/CharStrings'). */
/* */
/* cur_name :: XXX */
/* */
/* encoding_type :: XXX */
/* */
/* encoding_names :: XXX */
/* */
/* encoding_lengths :: XXX */
/* */
/* encoding_offsets :: XXX */
/* */
/* subrs :: XXX */
/* */
/* charstrings :: XXX */
/* */
typedef struct T1_Parser_
{
FT_Error error;
T1_Face face;
T1_Tokenizer tokenizer;
FT_Bool dump_tokens;
T1_Token stack[T1_MAX_STACK_DEPTH];
T1_Token* top;
T1_Token* limit;
T1_Token* args;
FT_Int state_index;
T1_DictState state_stack[T1_MAX_DICT_DEPTH];
T1_Table table;
FT_Int cur_name;
T1_EncodingType encoding_type;
FT_Byte* encoding_names;
FT_Int* encoding_lengths;
FT_Byte** encoding_offsets;
FT_Byte* subrs;
FT_Byte* charstrings;
} T1_Parser;
LOCAL_DEF
FT_Error T1_New_Table( T1_Table* table,
FT_Int count,
FT_Memory memory );
LOCAL_DEF
FT_Error T1_Add_Table( T1_Table* table,
FT_Int index,
void* object,
FT_Int length );
LOCAL_DEF
void T1_Done_Table( T1_Table* table );
LOCAL_DEF
FT_String* CopyString( T1_Parser* parser );
LOCAL_DEF
FT_Long CopyInteger( T1_Parser* parser );
LOCAL_DEF
FT_Bool CopyBoolean( T1_Parser* parser );
LOCAL_DEF
FT_Long CopyFloat( T1_Parser* parser,
FT_Int scale );
LOCAL_DEF
void CopyBBox( T1_Parser* parser,
FT_BBox* bbox );
LOCAL_DEF
void CopyMatrix( T1_Parser* parser,
FT_Matrix* matrix );
LOCAL_DEF
void CopyArray( T1_Parser* parser,
FT_Byte* num_elements,
FT_Short* elements,
FT_Int max_elements );
#ifdef __cplusplus
}
#endif
#endif /* T1PARSE_H */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,258 +0,0 @@
/***************************************************************************/
/* */
/* t1tokens.h */
/* */
/* Type 1 tokenizer (specification). */
/* */
/* 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. */
/* */
/***************************************************************************/
#ifndef T1TOKENS_H
#define T1TOKENS_H
#ifdef FT_FLAT_COMPILE
#include "t1objs.h"
#else
#include <type1/t1objs.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* enum value of first keyword */
#define key_first_ 100
/* enum value of first immediate name */
#define imm_first_ 200
typedef enum T1_TokenType_
{
tok_error = 0,
tok_eof, /* end of file */
/* simple token types */
tok_keyword, /* keyword */
tok_number, /* number (integer or real) */
tok_string, /* postscript string */
tok_program, /* postscript program */
tok_immediate, /* any immediate name */
tok_array, /* matrix, array, etc.. */
tok_hexarray, /* array of hexadecimal nibbles */
tok_any, /* anything else */
/* Postscript keywords -- placed in lexicographical order */
key_RD_alternate = key_first_, /* `-|' = alternate form of RD */
key_ExpertEncoding,
key_ND,
key_NP,
key_RD,
key_StandardEncoding,
key_array,
key_begin,
key_closefile,
key_currentdict,
key_currentfile,
key_def,
key_dict,
key_dup,
key_eexec,
key_end,
key_execonly,
key_false,
key_for,
key_index,
key_noaccess,
key_put,
key_readonly,
key_true,
key_userdict,
key_NP_alternate, /* `|' = alternate form of NP */
key_ND_alternate, /* `|-' = alternate form of ND */
key_max, /* always keep this value there */
/* Postscript immediate names -- other names will be ignored, except */
/* in charstrings */
imm_RD_alternate = imm_first_, /* `-|' = alternate form of RD */
imm_notdef, /* `/.notdef' immediate */
imm_BlendAxisTypes,
imm_BlueFuzz,
imm_BlueScale,
imm_BlueShift,
imm_BlueValues,
imm_CharStrings,
imm_Encoding,
imm_FamilyBlues,
imm_FamilyName,
imm_FamilyOtherBlues,
imm_FID,
imm_FontBBox,
imm_FontID,
imm_FontInfo,
imm_FontMatrix,
imm_FontName,
imm_FontType,
imm_ForceBold,
imm_FullName,
imm_ItalicAngle,
imm_LanguageGroup,
imm_Metrics,
imm_MinFeature,
imm_ND,
imm_NP,
imm_Notice,
imm_OtherBlues,
imm_OtherSubrs,
imm_PaintType,
imm_Private,
imm_RD,
imm_RndStemUp,
imm_StdHW,
imm_StdVW,
imm_StemSnapH,
imm_StemSnapV,
imm_StrokeWidth,
imm_Subrs,
imm_UnderlinePosition,
imm_UnderlineThickness,
imm_UniqueID,
imm_Weight,
imm_isFixedPitch,
imm_lenIV,
imm_password,
imm_version,
imm_NP_alternate, /* `|' = alternate form of NP */
imm_ND_alternate, /* `|-' = alternate form of ND */
imm_max /* always keep this value here */
} T1_TokenType;
/* these arrays are visible for debugging purposes */
extern const char* t1_keywords[];
extern const char* t1_immediates[];
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Token */
/* */
/* <Description> */
/* A structure used to describe a token in the current input stream. */
/* Note that the Type1 driver doesn't try to interpret tokens until */
/* it really needs to. */
/* */
/* <Fields> */
/* kind :: The token type. Describes the token to the loader. */
/* */
/* kind2 :: Detailed token type. */
/* */
/* start :: The index of the first character of token in the input */
/* stream. */
/* */
/* len :: The length of the token in characters. */
/* */
typedef struct T1_Token_
{
T1_TokenType kind; /* simple type */
T1_TokenType kind2; /* detailed type */
FT_Int start; /* index of first token character */
FT_Int len; /* length of token in chars */
} T1_Token;
typedef struct T1_TokenParser_
{
FT_Memory memory;
FT_Stream stream;
FT_Bool in_pfb; /* true if PFB file, PFA otherwise */
FT_Bool in_private; /* true if in private dictionary */
FT_Byte* base; /* base address of current read buffer */
FT_Long cursor; /* current position in read buffer */
FT_Long limit; /* limit of current read buffer */
FT_Long max; /* maximum size of read buffer */
FT_Error error; /* last error */
T1_Token token; /* last token read */
} T1_TokenParser;
/*************************************************************************/
/* */
/* <Type> */
/* T1_Tokenizer */
/* */
/* <Description> */
/* A handle to an object used to extract tokens from the input. The */
/* object is able to perform PFA/PFB recognition, eexec decryption of */
/* the private dictionary, as well as eexec decryption of the */
/* charstrings. */
/* */
typedef T1_TokenParser* T1_Tokenizer;
LOCAL_DEF
FT_Error New_Tokenizer( FT_Stream stream,
T1_Tokenizer* tokenizer );
LOCAL_DEF
FT_Error Done_Tokenizer( T1_Tokenizer tokenizer );
LOCAL_DEF
FT_Error Open_PrivateDict( T1_Tokenizer tokenizer );
LOCAL_DEF
FT_Error Read_Token( T1_Tokenizer tokenizer );
#if 0
LOCAL_DEF
FT_Error Read_CharStrings( T1_Tokenizer tokenizer,
FT_Int num_chars,
FT_Byte* buffer );
#endif /* 0 */
LOCAL_DEF
void t1_decrypt( FT_Byte* buffer,
FT_Int length,
FT_UShort seed );
#ifdef __cplusplus
}
#endif
#endif /* T1TOKENS_H */
/* END */

View File

@ -1,59 +0,0 @@
/***************************************************************************/
/* */
/* type1.c */
/* */
/* FreeType Type 1 driver component (body only). */
/* */
/* 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. */
/* */
/***************************************************************************/
#define FT_MAKE_OPTION_SINGLE_OBJECT
#ifdef FT_FLAT_COMPILE
#include "t1driver.c"
#include "t1objs.c"
#include "t1load.c"
#include "t1gload.c"
#include "t1tokens.c"
#include "t1parse.c"
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include "t1hinter.c"
#endif
#ifndef T1_CONFIG_OPTION_NO_AFM
#include "t1afm.c"
#endif
#else /* FT_FLAT_COMPILE */
#include <type1/t1driver.c>
#include <type1/t1objs.c>
#include <type1/t1load.c>
#include <type1/t1gload.c>
#include <type1/t1tokens.c>
#include <type1/t1parse.c>
#ifndef T1_CONFIG_OPTION_DISABLE_HINTER
#include <type1/t1hinter.c>
#endif
#ifndef T1_CONFIG_OPTION_NO_AFM
#include <type1/t1afm.c>
#endif
#endif /* FT_FLAT_COMPILE */
/* END */