Formatting, small fixes.

Adding copyright notices etc.
This commit is contained in:
Werner Lemberg 2000-08-23 17:32:42 +00:00
parent b466a7650c
commit 8728f294bc
28 changed files with 939 additions and 579 deletions

View File

@ -354,11 +354,12 @@
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* 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

@ -14,9 +14,6 @@
# indicate that you have read the license and understand and accept it
# fully.
#
# NOTE: This version requires that GNU Make is invoked from the Windows
# Shell (_not_ Cygwin BASH)!
#
ifndef TOP
TOP := .
@ -25,8 +22,8 @@ endif
DELETE := rm -f
SEP := /
HOSTSEP := $(SEP)
BUILD := $(TOP)/builds/unix/devel
PLATFORM := unixdev # do not set it to "unix", or libtool will trick you..
BUILD := $(TOP)/builds/unix/devel # we use a special devel ftoption.h
PLATFORM := unixdev # do not set it to `unix', or libtool will trick you
CC := gcc
# The directory where all object files are placed.

View File

@ -354,11 +354,12 @@
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* 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

@ -25,7 +25,7 @@ endif
DELETE := del
SEP := /
HOSTSEP := $(strip \ )
BUILD := $(TOP)/builds/win32/devel
BUILD := $(TOP)/builds/win32/devel # we use a special devel ftoption.h
PLATFORM := win32
CC := gcc

View File

@ -354,11 +354,12 @@
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* 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

@ -218,7 +218,7 @@
enum
{
ft_glyph_bbox_subpixels = 0, /* return unfitted coordinates in 26.6 pixels */
ft_glyph_bbox_subpixels = 0, /* return unfitted 26.6 coordinates */
ft_glyph_bbox_gridfit = 1, /* return grid-fitted coordinates */
ft_glyph_bbox_truncate = 2, /* return coordinates in integer pixels */
ft_glyph_bbox_pixels = 3 /* return grid-fitted pixel coordinates */

View File

@ -1,10 +1,35 @@
/***************************************************************************/
/* */
/* ftsynth.h */
/* */
/* FreeType synthesizing code for emboldening and slanting */
/* (specification). */
/* */
/* Copyright 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 FTSYNTH_H
#define FTSYNTH_H
#include <freetype/freetype.h>
/* this code is completely experimental - use with care */
/* it will probably be completely rewritten in the future */
#ifdef __cplusplus
extern "C" {
#endif
/* This code is completely experimental - use with care! */
/* It will probably be completely rewritten in the future */
/* or even integrated within the library... */
FT_EXPORT_DEF( FT_Error ) FT_Embolden_Outline( FT_Face original,
FT_Outline* outline,
@ -15,4 +40,12 @@
FT_Pos* advance );
#endif /* FTEMBOLD_H */
#ifdef __cplusplus
}
#endif
#endif /* FTSYNTH_H */
/* END */

View File

@ -84,7 +84,7 @@
trace_t1load,
trace_t1objs,
/* Postcript helper module 'psaux' */
/* PostScript helper module `psaux' */
trace_t1decode,
trace_psobjs,

View File

@ -37,21 +37,26 @@
/*************************************************************************/
/*************************************************************************/
typedef struct PS_Table_ PS_Table;
/*************************************************************************/
/* */
/* <Struct> */
/* PS_Table_Funcs */
/* */
/* <Description> */
/* A set of function pointers used to manage PS_Table objects.. */
/* A set of function pointers to manage PS_Table objects. */
/* */
/* <Fields> */
/* table_init :: used to initialise a a table */
/* table_done :: finalize/destroy a given table */
/* table_add :: add one new object to a table */
/* table_release :: release table data, then finalize it */
/* table_init :: Used to initialize a table. */
/* */
/* table_done :: Finalizes resp. destroy a given table. */
/* */
/* table_add :: Adds a new object to a table. */
/* */
/* table_release :: Releases table data, then finalizes it. */
/* */
typedef struct PS_Table_Funcs_
{
@ -101,7 +106,7 @@
/* memory :: The object used for memory operations */
/* (alloc/realloc). */
/* */
/* funcs :: table of method pointers for this object */
/* funcs :: A table of method pointers for this object. */
/* */
struct PS_Table_
{
@ -121,8 +126,6 @@
};
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -131,6 +134,7 @@
/*************************************************************************/
/*************************************************************************/
/* simple enumeration type used to identify token types */
typedef enum T1_Token_Type_
{
@ -264,28 +268,10 @@
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Parser */
/* */
/* <Description> */
/* A T1_Parser is an object used to parse a Type 1 font very quickly. */
/* */
/* <Fields> */
/* cursor :: The current position in the text. */
/* */
/* base :: Start of the processed text. */
/* */
/* limit :: End of the processed text. */
/* */
/* error :: The last error returned. */
/* */
/* funcs :: table of functions for the parser */
/* */
/* */
typedef struct T1_Parser_ T1_Parser;
typedef struct T1_Parser_Funcs_
{
void (*init) ( T1_Parser* parser,
@ -331,6 +317,27 @@
} T1_Parser_Funcs;
/*************************************************************************/
/* */
/* <Struct> */
/* T1_Parser */
/* */
/* <Description> */
/* A T1_Parser is an object used to parse a Type 1 font very quickly. */
/* */
/* <Fields> */
/* cursor :: The current position in the text. */
/* */
/* base :: Start of the processed text. */
/* */
/* limit :: End of the processed text. */
/* */
/* error :: The last error returned. */
/* */
/* memory :: The object used for memory operations (alloc/realloc). */
/* */
/* funcs :: A table of functions for the parser. */
/* */
struct T1_Parser_
{
FT_Byte* cursor;
@ -352,8 +359,10 @@
/*************************************************************************/
/*************************************************************************/
typedef struct T1_Builder_ T1_Builder;
typedef FT_Error (*T1_Builder_Check_Points_Func) ( T1_Builder* builder,
FT_Int count );
@ -449,7 +458,7 @@
/* the metrics of a given glyph, not load all of its */
/* points. */
/* */
/* funcs :: array of function pointers for the builder */
/* funcs :: An array of function pointers for the builder. */
/* */
struct T1_Builder_
{
@ -493,6 +502,7 @@
/*************************************************************************/
#if 0
#define T1_MAX_CHARSTRINGS_OPERANDS 64
#define T1_MAX_SUBRS_CALLS 16
@ -506,12 +516,12 @@
/*************************************************************************/
/* */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. */
/* A minimum of 16 is required.. */
/* T1_MAX_CHARSTRING_OPERANDS is the charstring stack's capacity. A */
/* minimum of 16 is required. */
/* */
#define T1_MAX_CHARSTRINGS_OPERANDS 32
#endif
#endif /* 0 */
typedef struct T1_Decoder_Zone_
@ -526,9 +536,11 @@
typedef struct T1_Decoder_ T1_Decoder;
typedef struct T1_Decoder_Funcs_ T1_Decoder_Funcs;
typedef FT_Error (*T1_Decoder_Callback)( T1_Decoder* decoder,
FT_UInt glyph_index );
struct T1_Decoder_Funcs_
{
FT_Error (*init) ( T1_Decoder* decoder,
@ -547,7 +559,6 @@
};
struct T1_Decoder_
{
T1_Builder builder;

View File

@ -859,9 +859,4 @@
}
#if 1
#endif /* 0 -- EXPERIMENTAL STUFF! */
/* END */

View File

@ -1,7 +1,27 @@
/***************************************************************************/
/* */
/* ftsynth.c */
/* */
/* FreeType synthesizing code for emboldening and slanting (body). */
/* */
/* Copyright 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/ftsynth.h>
#define FT_BOLD_THRESHOLD 0x0100
/*************************************************************************/
/*************************************************************************/
/**** ****/
@ -17,9 +37,13 @@
FT_Matrix transform;
FT_UNUSED( original );
/* we don't touch the advance width */
FT_UNUSED(advance);
/* For italic, simply apply a shear transform, with an angle */
/* of about 12 degrees.. */
/* of about 12 degrees. */
transform.xx = 0x10000;
transform.yx = 0x00000;
@ -29,12 +53,10 @@
FT_Transform_Outline( outline, &transform );
/* we don't touch the advance width */
FT_UNUSED(advance);
return 0;
}
/*************************************************************************/
/*************************************************************************/
/**** ****/
@ -43,6 +65,7 @@
/*************************************************************************/
/*************************************************************************/
/* Compute the norm of a vector */
#ifdef FT_CONFIG_OPTION_OLD_CALCS
@ -369,3 +392,4 @@
}
/* END */

48
src/cache/ftcimage.c vendored
View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* ftcimage.c */
/* */
/* XXX */
/* */
/* Copyright 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 <cache/ftcimage.h>
static
@ -5,9 +23,11 @@
FTC_ImageNode node )
{
FT_UNUSED( queue );
FT_Done_Glyph( FTC_IMAGENODE_GET_GLYPH( node ) );
}
static
FT_ULong ftc_size_bitmap_image( FTC_Image_Queue queue,
FTC_ImageNode node )
@ -16,6 +36,8 @@
FT_BitmapGlyph glyph;
FT_UNUSED( queue );
glyph = (FT_BitmapGlyph)FTC_IMAGENODE_GET_GLYPH(node);
pitch = glyph->bitmap.pitch;
if ( pitch < 0 )
@ -24,6 +46,7 @@
return (FT_ULong)(pitch * glyph->bitmap->rows + sizeof ( *glyph ) );
}
static
FT_ULong ftc_size_outline_image( FTC_Image_Queue queue,
FTC_ImageNode node )
@ -33,6 +56,8 @@
FT_Outline* outline;
FT_UNUSED( queue );
glyph = (FT_OutlineGlyph)FTC_IMAGENODE_GET_GLYPH( node );
outline = &glyph->outline;
@ -42,13 +67,14 @@
sizeof( *glyph ) );
}
/*******************************************************************/
/*******************************************************************/
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** MONOCHROME BITMAP CALLBACKS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/*************************************************************************/
/*************************************************************************/
static
FT_Error ftc_init_mono_image( FTC_Image_Queue queue,
@ -74,7 +100,7 @@
if ( face->glyph->format != ft_image_format_bitmap ||
face->glyph->bitmap.pixel_mode != ft_pixel_mode_mono )
{
/* there is no monochrome glyph for this font !! */
/* there is no monochrome glyph for this font! */
error = FT_Err_Invalid_Glyph_Index;
}
else
@ -117,7 +143,7 @@
if ( face->glyph->format != ft_image_format_bitmap ||
face->glyph->bitmap.pixel_mode != ft_pixel_mode_grays )
{
/* there is no monochrome glyph for this font !! */
/* there is no monochrome glyph for this font! */
error = FT_Err_Invalid_Glyph_Index;
}
else
@ -136,12 +162,4 @@
}
/*******************************************************************/
/*******************************************************************/
/***** *****/
/***** MONOCHROME BITMAP CALLBACKS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/* END */

54
src/cache/ftcimage.h vendored
View File

@ -1,13 +1,38 @@
/***************************************************************************/
/* */
/* ftcimage.h */
/* */
/* XXX */
/* */
/* Copyright 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 FTCIMAGE_H
#define FTCIMAGE_H
#include <cache/ftcmanag.h>
#include <freetype/ftglyph.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct FTC_Image_QueueRec_* FTC_Image_Queue;
typedef struct FTC_Image_CacheRec_* FTC_Image_Cache;
typedef struct FTC_ImageNodeRec_* FTC_ImageNode;
/* types of glyph images */
typedef enum FTC_Image_Type_
{
@ -29,24 +54,33 @@
} FTC_Image_Desc;
/* macros used to pack a glyph index and a queue index in a single ptr */
#define FTC_PTR_TO_GINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) >> 16 ) )
#define FTC_PTR_TO_QINDEX( p ) ( (FT_UInt)( (FT_ULong)(p) & 0xFFFF ) )
#define FTC_INDICES_TO_PTR(g,q) ((FT_Pointer)(((FT_ULong)(g) << 16) | \
#define FTC_INDICES_TO_PTR( g, q ) \
( (FT_Pointer)( ( (FT_ULong)(g) << 16 ) | \
( (FT_ULong)(q) & 0xFFFF) ) )
typedef struct FTC_ImageNodeRec_
{
FT_ListNodeRec root1; /* root1.data contains a FT_Glyph handle */
FT_ListNodeRec root2; /* root2.data contains a glyph index + queue index */
/* root1.data contains a FT_Glyph handle */
FT_ListNodeRec root1;
/* root2.data contains a glyph index + queue index */
FT_ListNodeRec root2;
} FTC_ImageNodeRec;
/* macros to read/set the glyph & queue index in a FTC_ImageNode */
#define FTC_IMAGENODE_GET_GINDEX( n ) FTC_PTR_TO_GINDEX( (n)->root2.data )
#define FTC_IMAGENODE_GET_QINDEX( n ) FTC_PTR_TO_QINDEX( (n)->root2.data )
#define FTC_IMAGENODE_SET_INDICES( g, q ) \
do { (n)->root2.data = FTC_INDICES_TO_PTR(g,q); } while (0)
do \
{ \
(n)->root2.data = FTC_INDICES_TO_PTR( g, q ); \
} while ( 0 )
typedef struct FTC_Image_CacheRec_
@ -96,9 +130,19 @@
FT_EXPORT_DEF( void ) FTC_Image_Cache_Done( FTC_Image_Cache cache );
FT_EXPORT_DEF(FT_Error) FTC_Image_Cache_Lookup( FTC_Image_Cache cache,
FT_EXPORT_DEF( FT_Error ) FTC_Image_Cache_Lookup(
FTC_Image_Cache cache,
FTC_Image_Desc* desc,
FT_UInt gindex,
FT_Glyph* aglyph );
#ifdef __cplusplus
}
#endif
#endif /* FTCIMAGE_H */
/* END */

55
src/cache/ftcmanag.c vendored
View File

@ -1,15 +1,35 @@
/***************************************************************************/
/* */
/* ftcmanag.h */
/* */
/* XXX */
/* */
/* Copyright 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 <cache/ftcmanag.h>
#include <freetype/internal/ftobjs.h>
#define FTC_LRU_GET_MANAGER( lru ) ((FTC_Manager_Lru)lru)->manager
/*******************************************************************/
/*******************************************************************/
/**************************************************************************/
/**************************************************************************/
/***** *****/
/***** FACE & SIZE LRU CALLBACKS *****/
/***** *****/
/*******************************************************************/
/*******************************************************************/
/**************************************************************************/
/**************************************************************************/
static
FT_Error ftc_manager_init_face( FT_Lru lru,
@ -18,15 +38,19 @@
FTC_Manager manager = FTC_LRU_GET_MANAGER( lru );
FT_Error error;
error = manager->request_face( (FTC_FaceID)node->key,
manager->request_data,
(FT_Face*)&node->root.data );
if ( !error )
{
/* destroy initial size object, it will be re-created later */
/* destroy initial size object; it will be re-created later */
FT_Face face = (FT_Face)node->root.data;
FT_Done_Size( face->size );
}
return error;
}
@ -38,9 +62,11 @@
FT_Pointer data )
{
FT_UNUSED( lru );
return ((FT_Size)node->root.data)->face == (FT_Face)data;
}
static
void ftc_manager_done_face( FT_Lru lru,
FT_LruNode node )
@ -48,8 +74,9 @@
FTC_Manager manager = FTC_LRU_GET_MANAGER( lru );
FT_Face face = (FT_Face)node->root.data;
/* we must begin by removing all sizes for the target face */
/* from the manager's list.. */
/* from the manager's list */
FT_Lru_Remove_Selection( manager->sizes_lru,
ftc_manager_size_selector,
face );
@ -79,6 +106,7 @@
FT_UNUSED( lru );
node->root.data = 0;
error = FT_New_Size( size_req->face, &size );
if ( !error )
@ -100,11 +128,11 @@
FT_LruNode node )
{
FT_UNUSED( lru );
FT_Done_Size( (FT_Size)node->root.data );
}
static
FT_Error ftc_manager_flush_size( FT_Lru lru,
FT_LruNode node,
@ -114,6 +142,7 @@
FT_Size size = (FT_Size)node->root.data;
FT_Error error;
if ( size->face == req->face )
{
size->face->size = size; /* set current size */
@ -139,14 +168,14 @@
FT_Size size = (FT_Size)node->root.data;
FT_UNUSED( node );
return ( size->face == req->face &&
size->metrics.x_ppem == req->width &&
size->metrics.y_ppem == req->height );
}
static
const FT_Lru_Class ftc_face_lru_class =
{
@ -169,7 +198,6 @@
};
FT_EXPORT_FUNC( FT_Error ) FTC_Manager_New( FT_Library library,
FTC_Face_Requester requester,
FT_Pointer req_data,
@ -218,10 +246,12 @@
return error;
}
FT_EXPORT_DEF( void ) FTC_Manager_Done( FTC_Manager manager )
{
FT_Memory memory = manager->library->memory;
FT_Lru_Done( manager->sizes_lru );
FT_Lru_Done( manager->faces_lru );
FREE( manager );
@ -245,7 +275,6 @@
}
FT_EXPORT_DEF( FT_Error ) FTC_Manager_Lookup_Size( FTC_Manager manager,
FTC_SizeID size_id,
FT_Face* aface,
@ -255,8 +284,10 @@
FT_Error error;
FT_Face face;
*aface = 0;
*asize = 0;
error = FTC_Manager_Lookup_Face( manager, size_id->face_id, &face );
if ( !error )
{
@ -274,7 +305,9 @@
*aface = face;
}
}
return error;
}
/* END */

34
src/cache/ftcmanag.h vendored
View File

@ -1,11 +1,36 @@
/***************************************************************************/
/* */
/* ftcmanag.h */
/* */
/* XXX */
/* */
/* Copyright 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 FTCMANAG_H
#define FTCMANAG_H
#include <cache/ftlru.h>
#ifdef __cplusplus
extern "C" {
#endif
#define FTC_MAX_FACES 4
#define FTC_MAX_SIZES 8
typedef FT_Pointer FTC_FaceID;
typedef struct FTC_SizeRec_
@ -62,4 +87,13 @@
FT_Face* aface,
FT_Size* asize );
#ifdef __cplusplus
}
#endif
#endif /* FTCMANAG_H */
/* END */

46
src/cache/ftlru.c vendored
View File

@ -1,7 +1,26 @@
/***************************************************************************/
/* */
/* ftlru.c */
/* */
/* XXX */
/* */
/* Copyright 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 <cache/ftlru.h>
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftlist.h>
static
void lru_build_free_list( FT_LruNode nodes,
FT_UInt count,
@ -10,6 +29,7 @@
FT_LruNode node = nodes;
FT_LruNode limit = node + count;
free_list->head = free_list->tail = 0;
for ( ; node < limit; node++ )
FT_List_Add( free_list, (FT_ListNode)node );
@ -25,6 +45,7 @@
FT_Error error;
FT_Lru lru;
*alru = 0;
if ( !ALLOC( lru, sizeof ( *lru ) ) )
{
@ -37,7 +58,7 @@
goto Exit;
}
/* build the 'free_nodes' list from the array */
/* build the `free_nodes' list from the array */
lru_build_free_list( lru->nodes, max_elements, &lru->free_nodes );
}
@ -45,8 +66,10 @@
lru->clazz = (FT_Lru_Class*)clazz;
lru->max_elements = max_elements;
lru->memory = memory;
*alru = lru;
}
Exit:
return error;
}
@ -59,10 +82,12 @@
FT_Lru_Class* clazz = lru->clazz;
FT_Memory memory = lru->memory;
while ( node )
{
FT_ListNode next = node->next;
clazz->done_element( lru, (FT_LruNode)node );
if ( !lru->nodes )
FREE( node );
@ -73,22 +98,22 @@
/* rebuild free list if necessary */
if ( lru->nodes )
lru_build_free_list( lru->nodes, lru->max_elements, &lru->free_nodes );
lru->elements.head = lru->elements.tail = 0;
lru->num_elements = 0;
}
FT_EXPORT_DEF( void ) FT_Lru_Done( FT_Lru lru )
{
FT_Memory memory = lru->memory;
FT_Lru_Reset( lru );
FREE( lru );
}
FT_EXPORT_DEF( FT_Error ) FT_Lru_Lookup_Node( FT_Lru lru,
FT_LruKey key,
FT_LruNode* anode )
@ -99,6 +124,7 @@
FT_LruNode found = 0;
FT_Memory memory = lru->memory;
if ( clazz->compare_element )
{
for ( ; node; node = node->next )
@ -120,11 +146,11 @@
if ( !found )
{
/* we didn't find the relevant element. We will now try */
/* to create a new one.. */
/* we haven't found the relevant element. We will now try */
/* to create a new one. */
if ( lru->num_elements >= lru->max_elements )
{
/* this lru list is full, we will now flush */
/* this lru list is full; we will now flush */
/* the oldest node */
FT_LruNode lru_node;
@ -163,6 +189,7 @@
{
FT_LruNode lru_node;
/* create a new lru list node, then the element for it */
if ( lru->nodes )
{
@ -210,6 +237,7 @@
FT_Error error;
FT_LruNode node;
*aobject = 0;
error = FT_Lru_Lookup_Node( lru, key, &node );
if ( !error )
@ -232,8 +260,11 @@
else
{
FT_Memory memory = lru->memory;
FREE( node );
}
lru->num_elements--;
}
}
@ -248,6 +279,7 @@
FT_ListNode node = lru->elements.head;
FT_ListNode next;
while ( node )
{
next = node->next;
@ -261,3 +293,5 @@
}
}
/* END */

34
src/cache/ftlru.h vendored
View File

@ -1,9 +1,32 @@
/***************************************************************************/
/* */
/* ftlru.h */
/* */
/* XXX */
/* */
/* Copyright 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 FTLRU_H
#define FTLRU_H
#include <freetype/freetype.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef FT_Pointer FT_LruKey;
@ -33,6 +56,7 @@
FT_Bool (*compare_element)( FT_LruNode node,
FT_LruKey key );
} FT_Lru_Class;
@ -40,6 +64,7 @@
FT_LruNode node,
FT_Pointer data );
typedef struct FT_LruRec_
{
FT_Lru_Class* clazz;
@ -80,4 +105,13 @@
FT_Lru_Selector selector,
FT_Pointer data );
#ifdef __cplusplus
}
#endif
#endif /* FTLRU_H */
/* END */

View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* psaux.c */
/* */
/* FreeType auxiliary PostScript 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
@ -14,3 +32,5 @@
#endif
/* END */

View File

@ -45,7 +45,7 @@
/* PS_Table_New */
/* */
/* <Description> */
/* Initialises a PS_Table. */
/* Initializes a PS_Table. */
/* */
/* <InOut> */
/* table :: The address of the target table. */
@ -1137,6 +1137,7 @@
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
if ( builder->shift )
{
x >>= 16;

View File

@ -1,8 +1,27 @@
/***************************************************************************/
/* */
/* t1decode.c */
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
/* Copyright 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 <psaux/t1decode.h>
#include <psaux/psobjs.h>
#include <freetype/internal/t1errors.h>
#include <freetype/ftoutln.h>
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -81,11 +100,11 @@
/*************************************************************************/
/* */
/* <Function> */
/* lookup_glyph_by_stdcharcode */
/* t1_lookup_glyph_by_stdcharcode */
/* */
/* <Description> */
/* Looks up a given glyph by its StandardEncoding charcode. Used */
/* to implement the SEAC Type 1 operator. */
/* Looks up a given glyph by its StandardEncoding charcode. Used to */
/* implement the SEAC Type 1 operator. */
/* */
/* <Input> */
/* face :: The current face object. */
@ -254,6 +273,7 @@
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
}
@ -262,7 +282,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
@ -279,7 +298,7 @@
/* charstring_len :: The length in bytes of the charstring stream. */
/* */
/* <Return> */
/* Free error code. 0 means success. */
/* FreeType error code. 0 means success. */
/* */
LOCAL_FUNC
FT_Error T1_Decoder_Parse_Charstrings( T1_Decoder* decoder,
@ -294,6 +313,7 @@
FT_Outline* outline;
FT_Pos x, y;
/* we don't want to touch the source code -- use macro trick */
#define start_point T1_Builder_Start_Point
#define check_points T1_Builder_Check_Points
@ -897,7 +917,7 @@
case op_pop:
FT_TRACE4(( " pop" ));
/* theorically, the arguments are already on the stack */
/* theoretically, the arguments are already on the stack */
top++;
break;
@ -996,11 +1016,13 @@
{
PSNames_Interface* psnames = 0;
psnames = (PSNames_Interface*)FT_Get_Module_Interface(
FT_FACE_LIBRARY(face), "psnames" );
if ( !psnames )
{
FT_ERROR(( "T1_Decoder_Init: the 'psnames' module is not available\n" ));
FT_ERROR(( "T1_Decoder_Init: " ));
FT_ERROR(( "the `psnames' module is not available\n" ));
return FT_Err_Unimplemented_Feature;
}
@ -1014,6 +1036,7 @@
decoder->parse_callback = parse_callback;
decoder->funcs = t1_decoder_funcs;
return 0;
}
@ -1024,3 +1047,5 @@
T1_Builder_Done( &decoder->builder );
}
/* END */

View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* t1decode.h */
/* */
/* PostScript Type 1 decoding routines (specification). */
/* */
/* Copyright 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 T1DECODE_H
#define T1DECODE_H
@ -5,6 +23,7 @@
#include <freetype/internal/psnames.h>
#include <freetype/internal/t1types.h>
LOCAL_DEF
const T1_Decoder_Funcs t1_decoder_funcs;
@ -29,4 +48,8 @@
LOCAL_DEF
void T1_Decoder_Done( T1_Decoder* decoder );
#endif /* T1DECODE_H */
/* END */

View File

@ -46,7 +46,6 @@
#define FT_COMPONENT trace_z1gload
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
@ -71,11 +70,14 @@
T1_Face face = (T1_Face)decoder->builder.face;
T1_Font* type1 = &face->type1;
return decoder->funcs.parse_charstrings( decoder,
return decoder->funcs.parse_charstrings(
decoder,
type1->charstrings [glyph_index],
type1->charstrings_len[glyph_index] );
}
LOCAL_FUNC
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance )
@ -89,7 +91,7 @@
*max_advance = 0;
/* Initialize load decoder */
/* initialize load decoder */
error = psaux->t1_decoder_funcs->init( &decoder,
(FT_Face)face,
0, /* size */
@ -175,7 +177,7 @@
if ( error )
goto Exit;
decoder.builder.no_recurse = ( load_flags & FT_LOAD_NO_RECURSE ) != 0;
decoder.builder.no_recurse = ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 );
decoder.num_subrs = type1->num_subrs;
decoder.subrs = type1->subrs;
@ -233,9 +235,11 @@
face->type1.font_offset.y );
#if 0
glyph->root.outline.second_pass = TRUE;
glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
glyph->root.outline.dropout_mode = 2;
#endif /* 0 */
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
@ -284,6 +288,7 @@
metrics->horiBearingY = cbox.yMax;
}
}
Exit:
return error;
}

View File

@ -36,7 +36,6 @@
#endif
LOCAL_DEF
FT_Error Z1_Compute_Max_Advance( T1_Face face,
FT_Int* max_advance );

View File

@ -1116,7 +1116,8 @@
encode->num_chars = count;
if ( ALLOC_ARRAY( encode->char_index, count, FT_Short ) ||
ALLOC_ARRAY( encode->char_name, count, FT_String* ) ||
( error = psaux->ps_table_funcs->init( char_table, count, memory ) ) != 0 )
( error = psaux->ps_table_funcs->init(
char_table, count, memory ) ) != 0 )
{
parser->root.error = error;
return;
@ -1235,6 +1236,7 @@
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
loader->num_subrs = Z1_ToInt( parser );
if ( parser->root.error )
return;
@ -1333,11 +1335,15 @@
return;
/* initialize tables */
error = psaux->ps_table_funcs->init( code_table, loader->num_glyphs, memory );
error = psaux->ps_table_funcs->init( code_table,
loader->num_glyphs,
memory );
if ( error )
goto Fail;
error = psaux->ps_table_funcs->init( name_table, loader->num_glyphs, memory );
error = psaux->ps_table_funcs->init( name_table,
loader->num_glyphs,
memory );
if ( error )
goto Fail;
@ -1555,7 +1561,9 @@
/* we found it -- run the parsing callback! */
parser->root.cursor = cur2;
Z1_Skip_Spaces( parser );
parser->root.error = t1_load_keyword( face, loader, keyword );
parser->root.error = t1_load_keyword( face,
loader,
keyword );
if ( parser->root.error )
return parser->root.error;
@ -1620,13 +1628,17 @@
PSAux_Interface* psaux = (PSAux_Interface*)face->psaux;
t1_init_loader( &loader, face );
/* default lenIV */
type1->private_dict.lenIV = 4;
parser = &loader.parser;
error = Z1_New_Parser( parser, face->root.stream, face->root.memory, psaux );
error = Z1_New_Parser( parser,
face->root.stream,
face->root.memory,
psaux );
if ( error )
goto Exit;

View File

@ -92,6 +92,7 @@
#undef FT_STRUCTURE
#define FT_STRUCTURE PFB_Tag
static
const FT_Frame_Field pfb_tag_fields[] =
{
@ -110,6 +111,7 @@
FT_Error error;
PFB_Tag head;
*tag = 0;
*size = 0;
if ( !READ_Fields( pfb_tag_fields, &head ) )
@ -134,6 +136,7 @@
FT_UShort tag;
FT_Long size;
psaux->t1_parser_funcs->init( &parser->root,0, 0, memory );
parser->stream = stream;

View File

@ -37,9 +37,9 @@
/* quickly. */
/* */
/* <Fields> */
/* stream :: The current input stream. */
/* root :: The root parser. */
/* */
/* memory :: The current memory object. */
/* stream :: The current input stream. */
/* */
/* base_dict :: A pointer to the top-level dictionary. */
/* */
@ -57,13 +57,6 @@
/* single_block :: A boolean. Indicates that the private dictionary */
/* is stored in lieu of the base dictionary. */
/* */
/* cursor :: The current parser cursor. */
/* */
/* limit :: The current parser limit (first byte after the */
/* current dictionary). */
/* */
/* error :: The current parsing error. */
/* */
typedef struct Z1_Parser_
{
T1_Parser root;
@ -83,8 +76,18 @@
#define Z1_Add_Table( p, i, o, l ) (p)->funcs.add( (p), i, o, l )
#define Z1_Done_Table(p) do { if ((p)->funcs.done) (p)->funcs.done( p ); } while (0)
#define Z1_Release_Table(p) do { if ((p)->funcs.release) (p)->funcs.release( p ); } while (0)
#define Z1_Done_Table( p ) \
do \
{ \
if ( (p)->funcs.done ) \
(p)->funcs.done( p ); \
} while ( 0 )
#define Z1_Release_Table( p ) \
do \
{ \
if ( (p)->funcs.release ) \
(p)->funcs.release( p ); \
} while ( 0 )
#define Z1_Skip_Spaces( p ) (p)->root.funcs.skip_spaces( &(p)->root )
@ -93,13 +96,20 @@
#define Z1_ToInt( p ) (p)->root.funcs.to_int( &(p)->root )
#define Z1_ToFixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
#define Z1_ToCoordArray(p,m,c) (p)->root.funcs.to_coord_array( &(p)->root, m, c )
#define Z1_ToFixedArray(p,m,f,t) (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
#define Z1_ToToken(p,t) (p)->root.funcs.to_token( &(p)->root, t )
#define Z1_ToTokenArray(p,t,m,c) (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
#define Z1_ToCoordArray( p, m, c ) \
(p)->root.funcs.to_coord_array( &(p)->root, m, c )
#define Z1_ToFixedArray( p, m, f, t ) \
(p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
#define Z1_ToToken( p, t ) \
(p)->root.funcs.to_token( &(p)->root, t )
#define Z1_ToTokenArray( p, t, m, c ) \
(p)->root.funcs.to_token_array( &(p)->root, t, m, c )
#define Z1_Load_Field( p, f, o, m, pf ) \
(p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
#define Z1_Load_Field_Table( p, f, o, m, pf ) \
(p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
#define Z1_Load_Field(p,f,o,m,pf) (p)->root.funcs.load_field( &(p)->root, f, o, m, pf )
#define Z1_Load_Field_Table(p,f,o,m,pf) (p)->root.funcs.load_field_table( &(p)->root, f, o, m, pf )
LOCAL_DEF
FT_Error Z1_New_Parser( Z1_Parser* parser,
@ -118,10 +128,12 @@
LOCAL_DEF
void Z1_Done_Parser( Z1_Parser* parser );
#ifdef __cplusplus
}
#endif
#endif /* Z1PARSE_H */