Minor formatting.

Adding copyright/C++ guards to psaux files.
This commit is contained in:
Werner Lemberg 2000-08-17 07:18:04 +00:00
parent 24d7024c44
commit b1c8bf0683
6 changed files with 163 additions and 78 deletions

View File

@ -1,8 +1,34 @@
/***************************************************************************/
/* */
/* psaux.h */
/* */
/* Auxiliary functions and data structures related to PostScript 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 PSAUX_H
#define PSAUX_H
#include <freetype/internal/ftobjs.h>
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -119,7 +145,7 @@
{
FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */
T1_Token_Type type; /* type of token.. */
T1_Token_Type type; /* type of token */
} T1_Token;
@ -239,17 +265,18 @@
/* T1_Parser */
/* */
/* <Description> */
/* A T1_Parser is an object used to parse a Type 1 font very */
/* quickly. */
/* A T1_Parser is an object used to parse a Type 1 font very quickly. */
/* */
/* <Fields> */
/* cursor :: current position in text. */
/* base :: start of processed text. */
/* limit :: end of processed text. */
/* error :: last error returned. */
/* cursor :: The current position in the text. */
/* */
typedef struct T1_Parser_
/* base :: Start of the processed text. */
/* */
/* limit :: End of the processed text. */
/* */
/* error :: The last error returned. */
/* */
typedef struct T1_Parser_
{
FT_Byte* cursor;
FT_Byte* base;
@ -260,7 +287,7 @@
} T1_Parser;
typedef struct T1_Parser_Funcs_
typedef struct T1_Parser_Funcs_
{
void (*init) ( T1_Parser* parser,
FT_Byte* base,
@ -284,11 +311,11 @@
FT_Int power_ten );
void (*to_token) ( T1_Parser* parser,
T1_Token *token );
T1_Token* token );
void (*to_token_array)( T1_Parser* parser,
T1_Token* tokens,
FT_UInt max_tokens,
FT_Int *pnum_tokens );
FT_Int* pnum_tokens );
FT_Error (*load_field) ( T1_Parser* parser,
const T1_Field* field,
@ -305,11 +332,10 @@
} T1_Parser_Funcs;
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** T1 BUILDER *****/
/***** T1 BUILDER *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
@ -330,10 +356,12 @@
/* */
/* glyph :: The current glyph slot. */
/* */
/* current :: The current glyph outline. */
/* loader :: XXX */
/* */
/* base :: The base glyph outline. */
/* */
/* current :: The current glyph outline. */
/* */
/* max_points :: maximum points in builder outline */
/* */
/* max_contours :: Maximal number of contours in builder outline. */
@ -398,28 +426,28 @@
} T1_Builder;
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder,
FT_Int count );
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder,
FT_Int count );
typedef void (*T1_Builder_Add_Point_Func) ( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag );
typedef void (*T1_Builder_Add_Point_Func)( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag );
typedef void (*T1_Builder_Add_Point1_Func)( T1_Builder* builder,
typedef void (*T1_Builder_Add_Point1_Func)( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
typedef FT_Error (*T1_Builder_Add_Contour_Func)( T1_Builder* builder );
typedef FT_Error (*T1_Builder_Start_Point_Func)( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
typedef FT_Error (*T1_Builder_Add_Contour_Func)( T1_Builder* builder );
typedef FT_Error (*T1_Builder_Start_Point_Func)( T1_Builder* builder,
FT_Pos x,
FT_Pos y );
typedef void (*T1_Builder_Close_Contour_Func)( T1_Builder* builder );
typedef void (*T1_Builder_Close_Contour_Func)( T1_Builder* builder );
typedef struct T1_Builder_Funcs_
typedef struct T1_Builder_Funcs_
{
FT_Error (*init)( T1_Builder* builder,
FT_Face face,
@ -437,6 +465,7 @@
} T1_Builder_Funcs;
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -445,15 +474,20 @@
/*************************************************************************/
/*************************************************************************/
typedef struct PSAux_Interface_
typedef struct PSAux_Interface_
{
const T1_Table_Funcs* t1_table_funcs;
const T1_Parser_Funcs* t1_parser_funcs;
const T1_Builder_Funcs* t1_builder_funcs;
const T1_Table_Funcs* t1_table_funcs;
const T1_Parser_Funcs* t1_parser_funcs;
const T1_Builder_Funcs* t1_builder_funcs;
} PSAux_Interface;
#ifdef __cplusplus
}
#endif
#endif /* PSAUX_H */
/* END */

View File

@ -87,7 +87,6 @@
typedef struct T1_Font_
{
/* font info dictionary */
T1_FontInfo font_info;

View File

@ -1020,7 +1020,7 @@
}
/* now, transform the glyph image when needed */
if ( face->transform_flags && !(load_flags & FT_LOAD_NO_RECURSE))
if ( face->transform_flags && !( load_flags & FT_LOAD_NO_RECURSE ) )
{
/* get renderer */
FT_Renderer renderer = ft_lookup_glyph_renderer( slot );

View File

@ -1,6 +1,35 @@
/***************************************************************************/
/* */
/* psobjs.c */
/* */
/* Auxiliary functions for PostScript 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. */
/* */
/***************************************************************************/
#include <freetype/internal/psaux.h>
#include <freetype/fterrors.h>
#ifdef FT_FLAT_COMPILE
#include "psobjs.h"
#else
#include <psaux/psobjs.h>
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -15,7 +44,7 @@
/* T1_New_Table */
/* */
/* <Description> */
/* Initialises a T1_Table. */
/* Initializes a T1_Table. */
/* */
/* <InOut> */
/* table :: The address of the target table. */
@ -43,7 +72,7 @@
goto Exit;
table->max_elems = count;
table->init = 0xDEADBEEF;
table->init = 0xDEADBEEFL;
table->num_elems = 0;
table->block = 0;
table->capacity = 0;
@ -157,7 +186,6 @@
}
/*************************************************************************/
/* */
/* <Function> */
@ -181,7 +209,7 @@
FT_Byte* old_base;
/* should never fail, as rec.cursor <= rec.size */
/* should never fail, because rec.cursor <= rec.size */
old_base = table->block;
if ( !old_base )
return;
@ -194,14 +222,13 @@
}
LOCAL_FUNC
void T1_Release_Table( T1_Table* table )
{
FT_Memory memory = table->memory;
if ( table->init == (FT_Long)0xDEADBEEF )
if ( table->init == 0xDEADBEEFL )
{
FREE( table->block );
FREE( table->elements );
@ -211,7 +238,6 @@
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -220,6 +246,7 @@
/*************************************************************************/
/*************************************************************************/
#define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' )
#define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' )
@ -266,7 +293,6 @@
}
LOCAL_FUNC
void T1_ToToken( T1_Parser* parser,
T1_Token* token )
@ -364,8 +390,8 @@
T1_ToToken( parser, &master );
if ( master.type == t1_token_array )
{
FT_Byte* old_cursor = parser->cursor;
FT_Byte* old_limit = parser->limit;
FT_Byte* old_cursor = parser->cursor;
FT_Byte* old_limit = parser->limit;
T1_Token* cur = tokens;
T1_Token* limit = cur + max_tokens;
@ -446,10 +472,10 @@
FT_Byte* limit,
FT_Long power_ten )
{
FT_Byte* cur = *cursor;
FT_Long num, divider, result;
FT_Int sign = 0;
FT_Byte d;
FT_Byte* cur = *cursor;
FT_Long num, divider, result;
FT_Int sign = 0;
FT_Byte d;
if ( cur >= limit )
@ -545,7 +571,7 @@
if ( cur >= limit )
goto Exit;
/* check for the beginning of an array. If not, only one number will */
/* check for the beginning of an array; if not, only one number will */
/* be read */
c = *cur;
ender = 0;
@ -786,6 +812,7 @@
FT_Long val;
FT_String* string;
switch ( field->type )
{
case t1_field_bool:
@ -824,8 +851,9 @@
FT_Memory memory = parser->memory;
FT_UInt len = limit-cur;
if ( *(FT_String**)q )
/* with synthetic fonts, it's possible to find a field twice */
/* with synthetic fonts, it's possible to find a field twice */
break;
if ( ALLOC( string, len + 1 ) )
@ -916,7 +944,7 @@
LOCAL_FUNC
FT_Long T1_ToInt ( T1_Parser* parser )
FT_Long T1_ToInt( T1_Parser* parser )
{
return t1_toint( &parser->cursor, parser->limit );
}
@ -970,10 +998,10 @@
LOCAL_FUNC
void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory )
void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory )
{
parser->error = 0;
parser->base = base;
@ -984,11 +1012,12 @@
LOCAL_FUNC
void T1_Done_Parser( T1_Parser* parser )
void T1_Done_Parser( T1_Parser* parser )
{
FT_UNUSED(parser);
FT_UNUSED( parser );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -1193,6 +1222,7 @@
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points - 1;
if ( outline->n_contours > 1 )
{
first = outline->contours[outline->n_contours - 2] + 1;
@ -1208,7 +1238,6 @@
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -1218,10 +1247,6 @@
/*************************************************************************/
LOCAL_FUNC
void T1_Decrypt( FT_Byte* buffer,
FT_Int length,
@ -1240,5 +1265,4 @@
}
/* END */

View File

@ -1,9 +1,32 @@
/***************************************************************************/
/* */
/* psobjs.h */
/* */
/* Auxiliary functions for PostScript 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 PSOBJS_H
#define PSOBJS_H
#include <freetype/internal/psaux.h>
#ifdef __cplusplus
extern "C" {
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -31,7 +54,6 @@
void T1_Release_Table( T1_Table* table );
/*************************************************************************/
/*************************************************************************/
/***** *****/
@ -72,7 +94,7 @@
FT_ULong* pflags );
LOCAL_DEF
FT_Long T1_ToInt ( T1_Parser* parser );
FT_Long T1_ToInt( T1_Parser* parser );
LOCAL_DEF
@ -93,14 +115,13 @@
LOCAL_DEF
void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory );
void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory );
LOCAL_DEF
void T1_Done_Parser( T1_Parser* parser )
void T1_Done_Parser( T1_Parser* parser )
LOCAL_DEF
@ -109,5 +130,12 @@
FT_UShort seed );
#ifdef __cplusplus
}
#endif
#endif /* PSOBJS_H */
/* END */

View File

@ -1080,14 +1080,14 @@
(void)Z1_ToFixedArray( parser, 6, temp, 3 );
/* we need to scale the values by 1.0/temp[3] */
if ( temp[3] != 0x10000 )
if ( temp[3] != 0x10000L )
{
temp[0] = FT_DivFix( temp[0], temp[3] );
temp[1] = FT_DivFix( temp[1], temp[3] );
temp[2] = FT_DivFix( temp[2], temp[3] );
temp[4] = FT_DivFix( temp[4], temp[3] );
temp[5] = FT_DivFix( temp[5], temp[3] );
temp[3] = 0x10000;
temp[3] = 0x10000L;
}
matrix->xx = temp[0];