From b1c8bf0683d2892bb9cb061b71add4b61da017f0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 17 Aug 2000 07:18:04 +0000 Subject: [PATCH] Minor formatting. Adding copyright/C++ guards to psaux files. --- include/freetype/internal/psaux.h | 106 ++++++++++++++++++---------- include/freetype/internal/t1types.h | 1 - src/base/ftobjs.c | 2 +- src/psaux/psobjs.c | 84 ++++++++++++++-------- src/psaux/psobjs.h | 44 +++++++++--- src/type1z/z1load.c | 4 +- 6 files changed, 163 insertions(+), 78 deletions(-) diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index d840992d5..5eaeada96 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -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 + +#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 */ /* */ /* */ - /* 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. */ /* */ /* */ - /* 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 */ diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index c5afb7c21..a84ad838a 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -87,7 +87,6 @@ typedef struct T1_Font_ { - /* font info dictionary */ T1_FontInfo font_info; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index acc7fc76e..a9c9344d7 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -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 ); diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index af4ca1b63..2912cde67 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -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 #include +#ifdef FT_FLAT_COMPILE + +#include "psobjs.h" + +#else + +#include + +#endif + + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -15,7 +44,7 @@ /* T1_New_Table */ /* */ /* */ - /* Initialises a T1_Table. */ + /* Initializes a T1_Table. */ /* */ /* */ /* 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 @@ } - /*************************************************************************/ /* */ /* */ @@ -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 */ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index 84c4359b5..c321536d4 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -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 +#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 */ diff --git a/src/type1z/z1load.c b/src/type1z/z1load.c index 4a19402dd..dd70892f0 100644 --- a/src/type1z/z1load.c +++ b/src/type1z/z1load.c @@ -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];