Don't use -lefence in the demo Makefile.

Added C++ guards in ftmodule.h

Fix error check in ftglyph.c

Formatting; adding copyrights; fixing documentation
This commit is contained in:
Werner Lemberg 2000-07-04 03:37:18 +00:00
parent d0c36e3b5a
commit aa8c7da0bf
8 changed files with 1062 additions and 1093 deletions

View File

@ -87,7 +87,7 @@ else
# with the program by default on Unix, we thus add it whenever appropriate # with the program by default on Unix, we thus add it whenever appropriate
# #
ifeq ($(PLATFORM),unix) ifeq ($(PLATFORM),unix)
LINK += -lm -lefence LINK += -lm
endif endif
COMMON_LINK = $(LINK) $(COMMON_OBJ) COMMON_LINK = $(LINK) $(COMMON_OBJ)

View File

@ -20,6 +20,11 @@
#include <freetype/freetype.h> #include <freetype/freetype.h>
#ifdef __cplusplus
extern "C" {
#endif
/* module bit flags */ /* module bit flags */
typedef enum FT_Module_Flags_ typedef enum FT_Module_Flags_
{ {
@ -278,6 +283,10 @@
FT_EXPORT_DEF(void) FT_Add_Default_Modules( FT_Library library ); FT_EXPORT_DEF(void) FT_Add_Default_Modules( FT_Library library );
#ifdef __cplusplus
}
#endif
#endif /* FTMODULE_H */ #endif /* FTMODULE_H */

View File

@ -488,7 +488,7 @@
if ( !slot ) if ( !slot )
return FT_Err_Invalid_Slot_Handle; return FT_Err_Invalid_Slot_Handle;
if ( !glyph ) if ( !aglyph )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
/* if it is a bitmap, that's easy :-) */ /* if it is a bitmap, that's easy :-) */
@ -561,6 +561,7 @@
/* <Note> */ /* <Note> */
/* The 2x2 transformation matrix is also applied to the glyph's */ /* The 2x2 transformation matrix is also applied to the glyph's */
/* advance vector. */ /* advance vector. */
/* */
FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph, FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph,
FT_Matrix* matrix, FT_Matrix* matrix,
FT_Vector* delta ) FT_Vector* delta )

View File

@ -542,17 +542,17 @@
case ft_frame_bytes: /* read a byte sequence */ case ft_frame_bytes: /* read a byte sequence */
{ {
FT_Int len = stream->limit - stream->cursor; FT_Int len = stream->limit - stream->cursor;
if (len > fields->size)
if ( len > fields->size )
len = fields->size; len = fields->size;
p = (FT_Byte*)structure + fields->offset; p = (FT_Byte*)structure + fields->offset;
MEM_Copy( p, stream->cursor, len ); MEM_Copy( p, stream->cursor, len );
stream->cursor += len; stream->cursor += len;
fields++; fields++;
continue; continue;
} }
case ft_frame_byte: case ft_frame_byte:
case ft_frame_schar: /* read a single byte */ case ft_frame_schar: /* read a single byte */

View File

@ -1348,12 +1348,6 @@
FT_FRAME_END FT_FRAME_END
}; };
static const FT_Frame_Field pclt_fields2[] =
{
FT_FRAME_START( 4 ),
FT_FRAME_END
};
FT_Error error; FT_Error error;
TT_PCLT* pclt = &face->pclt; TT_PCLT* pclt = &face->pclt;

File diff suppressed because it is too large Load Diff

View File

@ -1,43 +1,38 @@
/******************************************************************* /***************************************************************************/
* /* */
* t1tokens.h /* t1tokens.h */
* /* */
* Type 1 tokenizer /* Type 1 tokenizer (specification). */
* /* */
* Copyright 1996 David Turner, Robert Wilhelm and Werner Lemberg. /* 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 /* This file is part of the FreeType project, and may only be used, */
* license, LICENSE.TXT. By continuing to use, modify or distribute /* modified, and distributed under the terms of the FreeType project */
* this file you indicate that you have read the license and /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
* understand and accept it fully. /* this file you indicate that you have read the license and */
* /* understand and accept it fully. */
* The tokenizer is in charge of loading and reading a Type1 font /* */
* file (either in PFB or PFA format), and extract successive tokens /***************************************************************************/
* and keywords from its two streams (i.e. the font program, and the
* private dictionary).
*
* Eexec decryption is performed automatically when entering the
* private dictionary, or when retrieving char strings..
*
******************************************************************/
#ifndef T1TOKENS_H #ifndef T1TOKENS_H
#define T1TOKENS_H #define T1TOKENS_H
#include <t1objs.h> #include <t1objs.h>
/* enum value of first keyword */ /* enum value of first keyword */
#define key_first_ 100 #define key_first_ 100
/* enum value of first immediate name */ /* enum value of first immediate name */
#define imm_first_ 200 #define imm_first_ 200
typedef enum T1_TokenType_
typedef enum T1_TokenType_
{ {
tok_error = 0, tok_error = 0,
tok_eof, /* end of file */ tok_eof, /* end of file */
/* simple token types */ /* simple token types */
@ -50,14 +45,14 @@
tok_hexarray, /* array of hexadecimal nibbles */ tok_hexarray, /* array of hexadecimal nibbles */
tok_any, /* anything else */ tok_any, /* anything else */
/* Postscript keywords - placed in lexicographical order */ /* Postscript keywords -- placed in lexicographical order */
key_RD_alternate = key_first_, /* "-|" = alternate form of RD */ key_RD_alternate = key_first_, /* `-|' = alternate form of RD */
key_ExpertEncoding, key_ExpertEncoding,
key_ND, key_ND,
key_NP, key_NP,
key_RD, key_RD,
key_StandardEncoding, key_StandardEncoding,
key_array, key_array,
key_begin, key_begin,
key_closefile, key_closefile,
@ -77,16 +72,16 @@
key_readonly, key_readonly,
key_true, key_true,
key_userdict, key_userdict,
key_NP_alternate, /* "|" = alternate form of NP */ key_NP_alternate, /* `|' = alternate form of NP */
key_ND_alternate, /* "|-" = alternate form of ND */ key_ND_alternate, /* `|-' = alternate form of ND */
key_max, /* always keep this value there */ key_max, /* always keep this value there */
/* Postscript immediate names - other names will be ignored, except */ /* Postscript immediate names -- other names will be ignored, except */
/* in charstrings.. */ /* in charstrings */
imm_RD_alternate = imm_first_, /* "-|" = alternate form of RD */ imm_RD_alternate = imm_first_, /* `-|' = alternate form of RD */
imm_notdef, /* "/.notdef" immediate */ imm_notdef, /* `/.notdef' immediate */
imm_BlendAxisTypes, imm_BlendAxisTypes,
imm_BlueFuzz, imm_BlueFuzz,
imm_BlueScale, imm_BlueScale,
@ -135,219 +130,109 @@
imm_password, imm_password,
imm_version, imm_version,
imm_NP_alternate, /* "|" = alternate form of NP */ imm_NP_alternate, /* `|' = alternate form of NP */
imm_ND_alternate, /* "|-" = alternate form of ND */ imm_ND_alternate, /* `|-' = alternate form of ND */
imm_max /* always keep this value here */ imm_max /* always keep this value here */
} T1_TokenType; } T1_TokenType;
/* these arrays are visible for debugging purposes.. */ /* these arrays are visible for debugging purposes */
extern const char* t1_keywords[]; extern const char* t1_keywords[];
extern const char* t1_immediates[]; extern const char* t1_immediates[];
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Struct> T1_Token */ /* <Struct> */
/* */ /* T1_Token */
/* <Description> */ /* */
/* A structure used to describe a token in the current input */ /* <Description> */
/* stream. Note that the Type1 driver doesn't try to interpret */ /* A structure used to describe a token in the current input stream. */
/* tokens until it really needs to.. */ /* Note that the Type1 driver doesn't try to interpret tokens until */
/* */ /* it really needs to. */
/* <Fields> */ /* */
/* kind :: token type. Describes the token to the loader */ /* <Fields> */
/* kind2 :: detailed token type. */ /* kind :: The token type. Describes the token to the loader. */
/* */ /* */
/* start :: index of first character of token in input stream */ /* kind2 :: Detailed token type. */
/* */ /* */
/* len :: length of token in characters. */ /* start :: The index of the first character of token in the input */
/* */ /* stream. */
typedef struct T1_Token_ /* */
/* len :: The length of the token in characters. */
/* */
typedef struct T1_Token_
{ {
T1_TokenType kind; /* simple type */ T1_TokenType kind; /* simple type */
T1_TokenType kind2; /* detailed type */ T1_TokenType kind2; /* detailed type */
FT_Int start; /* index of first token character */ FT_Int start; /* index of first token character */
FT_Int len; /* length of token in chars */ FT_Int len; /* length of token in chars */
} T1_Token; } T1_Token;
typedef struct T1_TokenParser_
typedef struct T1_TokenParser_
{ {
FT_Memory memory; FT_Memory memory;
FT_Stream stream; FT_Stream stream;
FT_Bool in_pfb; /* true if PFB file, PFA otherwise */ FT_Bool in_pfb; /* true if PFB file, PFA otherwise */
FT_Bool in_private; /* true if in private dictionary */ FT_Bool in_private; /* true if in private dictionary */
FT_Byte* base; /* base address of current read buffer */ FT_Byte* base; /* base address of current read buffer */
FT_Long cursor; /* current position in read buffer */ FT_Long cursor; /* current position in read buffer */
FT_Long limit; /* limit of current read buffer */ FT_Long limit; /* limit of current read buffer */
FT_Long max; /* maximum size of read buffer */ FT_Long max; /* maximum size of read buffer */
FT_Error error; /* last error */ FT_Error error; /* last error */
T1_Token token; /* last token read */ T1_Token token; /* last token read */
} T1_TokenParser; } T1_TokenParser;
/*************************************************************************/
/*************************************************************************/ /* */
/* */ /* <Type> */
/* <Type> T1_Tokenizer */ /* T1_Tokenizer */
/* */ /* */
/* <Description> */ /* <Description> */
/* A handle to an object used to extract tokens from the input. */ /* A handle to an object used to extract tokens from the input. The */
/* The object is able to perform PFA/PFB recognition, eexec */ /* object is able to perform PFA/PFB recognition, eexec decryption of */
/* decryption of the private dictionary, as well as eexec decryption */ /* the private dictionary, as well as eexec decryption of the */
/* of the charstrings.. */ /* charstrings. */
/* */ /* */
typedef T1_TokenParser* T1_Tokenizer; typedef T1_TokenParser* T1_Tokenizer;
/*************************************************************************/ LOCAL_DEF
/* */ FT_Error New_Tokenizer( FT_Stream stream,
/* <Function> New_Tokenizer */ T1_Tokenizer* tokenizer );
/* */
/* <Description> */
/* Creates a new tokenizer from a given input stream. This function */
/* automatically recognizes "pfa" or "pfb" files. The function */
/* "Read_Token" can then be used to extract successive tokens from */
/* the stream.. */
/* */
/* <Input> */
/* stream :: input stream */
/* */
/* <Output> */
/* tokenizer :: handle to new tokenizer object.. */
/* */
/* <Return> */
/* Type1 error code. 0 means success.. */
/* */
/* <Note> */
/* This function copies the stream handle within the object. Callers */
/* should not discard "stream". This is done by the Done_Tokenizer */
/* function.. */
/* */
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 );
/* <Function> Done_Tokenizer */
/* */
/* <Description> */
/* Closes a given tokenizer. This function will also close the */
/* stream embedded in the object.. */
/* */
/* <Input> */
/* tokenizer :: target tokenizer object */
/* */
/* <Return> */
/* Type1 error code. 0 means success.. */
/* */
LOCAL_DEF
FT_Error Done_Tokenizer( T1_Tokenizer tokenizer );
/*************************************************************************/
/* */
/* <Function> Open_PrivateDict */
/* */
/* <Description> */
/* This function must be called to set the tokenizer to the private */
/* section of the Type1 file. It recognizes automatically the */
/* the kind of eexec encryption used (ascii or binary).. */
/* */
/* <Input> */
/* tokenizer :: target tokenizer object */
/* lenIV :: value of the "lenIV" variable.. */
/* */
/* <Return> */
/* Type1 error code. 0 means success.. */
/* */
LOCAL_DEF
FT_Error Open_PrivateDict( T1_Tokenizer tokenizer );
/*************************************************************************/
/* */
/* <Function> Read_Token */
/* */
/* <Description> */
/* Read a new token from the current input stream. This function */
/* extracts a token from the font program until "Open_PrivateDict" */
/* has been called. After this, it returns tokens from the */
/* (eexec-encrypted) private dictionnary.. */
/* */
/* <Input> */
/* tokenizer :: target tokenizer object */
/* */
/* <Return> */
/* Type1 error code. 0 means success.. */
/* */
/* <Note> */
/* One should use the function Read_CharStrings to read the binary */
/* charstrings from the private dict.. */
/* */
LOCAL_DEF
FT_Error Read_Token( T1_Tokenizer tokenizer );
#if 0 #if 0
/*************************************************************************/ LOCAL_DEF
/* */ FT_Error Read_CharStrings( T1_Tokenizer tokenizer,
/* <Function> Read_CharStrings */ FT_Int num_chars,
/* */ FT_Byte* buffer );
/* <Description> */ #endif /* 0 */
/* Read a charstrings from the current input stream. These are */
/* binary bytes that encode each individual glyph outline. */
/* */
/* <Input> */
/* tokenizer :: target tokenizer object */
/* num_chars :: number of binary bytes to read */
/* */
/* <Output> */
/* buffer :: target array of bytes. These are eexec-decrypted.. */
/* */
/* <Return> */
/* Type1 error code. 0 means success.. */
/* */
/* <Note> */
/* One should use the function Read_CharStrings to read the binary */
/* charstrings from the private dict.. */
/* */
LOCAL_DEF
FT_Error Read_CharStrings( T1_Tokenizer tokenizer,
FT_Int num_chars,
FT_Byte* buffer );
#endif
/*************************************************************************/
/* */
/* <Function> t1_decrypt */
/* */
/* <Description> */
/* Performs the Type 1 charstring decryption process.. */
/* */
/* <Input> */
/* buffer :: base address of data to decrypt */
/* length :: number of bytes to decrypt from base address */
/* seed :: ecnryption seed (4330 for charstrings). */
/* */
LOCAL_DEF LOCAL_DEF
void t1_decrypt( FT_Byte* buffer, void t1_decrypt( FT_Byte* buffer,
FT_Int length, FT_Int length,
FT_UShort seed ); FT_UShort seed );
#endif /* T1TOKENS_H */ #endif /* T1TOKENS_H */
/* END */

View File

@ -2,29 +2,17 @@
/* */ /* */
/* type1.c */ /* type1.c */
/* */ /* */
/* FreeType Type 1 driver component */ /* FreeType Type 1 driver component (body only). */
/* */ /* */
/* Copyright 1996-1998 by */ /* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used, */
/* modified and distributed under the terms of the FreeType project */ /* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */ /* this file you indicate that you have read the license and */
/* understand and accept it fully. */ /* understand and accept it fully. */
/* */ /* */
/* */
/* This file is used to compile the FreeType Type 1 font driver. */
/* It relies on all components included in the "base" layer (see */
/* the file "ftbase.c"). Source code is located in "freetype/ttlib" */
/* and contains : */
/* */
/* - a driver interface */
/* - an object manager */
/* - a table loader */
/* - a glyph loader */
/* - a glyph hinter */
/* */
/***************************************************************************/ /***************************************************************************/
@ -32,7 +20,7 @@
#include <t1driver.c> #include <t1driver.c>
#include <t1objs.c> #include <t1objs.c>
#include <t1load.c> /* table loader */ #include <t1load.c>
#include <t1gload.c> #include <t1gload.c>
#include <t1tokens.c> #include <t1tokens.c>
#include <t1parse.c> #include <t1parse.c>
@ -44,3 +32,6 @@
#ifndef T1_CONFIG_OPTION_NO_AFM #ifndef T1_CONFIG_OPTION_NO_AFM
#include <t1afm.c> #include <t1afm.c>
#endif #endif
/* END */