Minor formatting.
Adding copyright/C++ guards to psaux files.
This commit is contained in:
parent
24d7024c44
commit
b1c8bf0683
|
@ -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
|
#ifndef PSAUX_H
|
||||||
#define PSAUX_H
|
#define PSAUX_H
|
||||||
|
|
||||||
|
|
||||||
#include <freetype/internal/ftobjs.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* start; /* first character of token in input stream */
|
||||||
FT_Byte* limit; /* first character after the token */
|
FT_Byte* limit; /* first character after the token */
|
||||||
T1_Token_Type type; /* type of token.. */
|
T1_Token_Type type; /* type of token */
|
||||||
|
|
||||||
} T1_Token;
|
} T1_Token;
|
||||||
|
|
||||||
|
@ -239,16 +265,17 @@
|
||||||
/* T1_Parser */
|
/* T1_Parser */
|
||||||
/* */
|
/* */
|
||||||
/* <Description> */
|
/* <Description> */
|
||||||
/* A T1_Parser is an object used to parse a Type 1 font very */
|
/* A T1_Parser is an object used to parse a Type 1 font very quickly. */
|
||||||
/* quickly. */
|
|
||||||
/* */
|
/* */
|
||||||
/* <Fields> */
|
/* <Fields> */
|
||||||
/* cursor :: current position in text. */
|
/* cursor :: The current position in the text. */
|
||||||
/* base :: start of processed text. */
|
/* */
|
||||||
/* limit :: end of processed text. */
|
/* base :: Start of the processed text. */
|
||||||
/* error :: last error returned. */
|
/* */
|
||||||
|
/* limit :: End of the processed text. */
|
||||||
|
/* */
|
||||||
|
/* error :: The last error returned. */
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
typedef struct T1_Parser_
|
typedef struct T1_Parser_
|
||||||
{
|
{
|
||||||
FT_Byte* cursor;
|
FT_Byte* cursor;
|
||||||
|
@ -284,11 +311,11 @@
|
||||||
FT_Int power_ten );
|
FT_Int power_ten );
|
||||||
|
|
||||||
void (*to_token) ( T1_Parser* parser,
|
void (*to_token) ( T1_Parser* parser,
|
||||||
T1_Token *token );
|
T1_Token* token );
|
||||||
void (*to_token_array)( T1_Parser* parser,
|
void (*to_token_array)( T1_Parser* parser,
|
||||||
T1_Token* tokens,
|
T1_Token* tokens,
|
||||||
FT_UInt max_tokens,
|
FT_UInt max_tokens,
|
||||||
FT_Int *pnum_tokens );
|
FT_Int* pnum_tokens );
|
||||||
|
|
||||||
FT_Error (*load_field) ( T1_Parser* parser,
|
FT_Error (*load_field) ( T1_Parser* parser,
|
||||||
const T1_Field* field,
|
const T1_Field* field,
|
||||||
|
@ -305,7 +332,6 @@
|
||||||
} T1_Parser_Funcs;
|
} T1_Parser_Funcs;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -330,10 +356,12 @@
|
||||||
/* */
|
/* */
|
||||||
/* glyph :: The current glyph slot. */
|
/* glyph :: The current glyph slot. */
|
||||||
/* */
|
/* */
|
||||||
/* current :: The current glyph outline. */
|
/* loader :: XXX */
|
||||||
/* */
|
/* */
|
||||||
/* base :: The base glyph outline. */
|
/* base :: The base glyph outline. */
|
||||||
/* */
|
/* */
|
||||||
|
/* current :: The current glyph outline. */
|
||||||
|
/* */
|
||||||
/* max_points :: maximum points in builder outline */
|
/* max_points :: maximum points in builder outline */
|
||||||
/* */
|
/* */
|
||||||
/* max_contours :: Maximal number of contours in builder outline. */
|
/* max_contours :: Maximal number of contours in builder outline. */
|
||||||
|
@ -401,7 +429,7 @@
|
||||||
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder,
|
typedef FT_Error (*T1_Builder_Check_Points_Func)( T1_Builder* builder,
|
||||||
FT_Int count );
|
FT_Int count );
|
||||||
|
|
||||||
typedef void (*T1_Builder_Add_Point_Func) ( T1_Builder* builder,
|
typedef void (*T1_Builder_Add_Point_Func)( T1_Builder* builder,
|
||||||
FT_Pos x,
|
FT_Pos x,
|
||||||
FT_Pos y,
|
FT_Pos y,
|
||||||
FT_Byte flag );
|
FT_Byte flag );
|
||||||
|
@ -437,6 +465,7 @@
|
||||||
|
|
||||||
} T1_Builder_Funcs;
|
} T1_Builder_Funcs;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -445,8 +474,6 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct PSAux_Interface_
|
typedef struct PSAux_Interface_
|
||||||
{
|
{
|
||||||
const T1_Table_Funcs* t1_table_funcs;
|
const T1_Table_Funcs* t1_table_funcs;
|
||||||
|
@ -456,4 +483,11 @@
|
||||||
} PSAux_Interface;
|
} PSAux_Interface;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* PSAUX_H */
|
#endif /* PSAUX_H */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
||||||
|
|
|
@ -87,7 +87,6 @@
|
||||||
|
|
||||||
typedef struct T1_Font_
|
typedef struct T1_Font_
|
||||||
{
|
{
|
||||||
|
|
||||||
/* font info dictionary */
|
/* font info dictionary */
|
||||||
T1_FontInfo font_info;
|
T1_FontInfo font_info;
|
||||||
|
|
||||||
|
|
|
@ -1020,7 +1020,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now, transform the glyph image when needed */
|
/* 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 */
|
/* get renderer */
|
||||||
FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
|
FT_Renderer renderer = ft_lookup_glyph_renderer( slot );
|
||||||
|
|
|
@ -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/internal/psaux.h>
|
||||||
#include <freetype/fterrors.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 */
|
/* T1_New_Table */
|
||||||
/* */
|
/* */
|
||||||
/* <Description> */
|
/* <Description> */
|
||||||
/* Initialises a T1_Table. */
|
/* Initializes a T1_Table. */
|
||||||
/* */
|
/* */
|
||||||
/* <InOut> */
|
/* <InOut> */
|
||||||
/* table :: The address of the target table. */
|
/* table :: The address of the target table. */
|
||||||
|
@ -43,7 +72,7 @@
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
table->max_elems = count;
|
table->max_elems = count;
|
||||||
table->init = 0xDEADBEEF;
|
table->init = 0xDEADBEEFL;
|
||||||
table->num_elems = 0;
|
table->num_elems = 0;
|
||||||
table->block = 0;
|
table->block = 0;
|
||||||
table->capacity = 0;
|
table->capacity = 0;
|
||||||
|
@ -157,7 +186,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Function> */
|
/* <Function> */
|
||||||
|
@ -181,7 +209,7 @@
|
||||||
FT_Byte* old_base;
|
FT_Byte* old_base;
|
||||||
|
|
||||||
|
|
||||||
/* should never fail, as rec.cursor <= rec.size */
|
/* should never fail, because rec.cursor <= rec.size */
|
||||||
old_base = table->block;
|
old_base = table->block;
|
||||||
if ( !old_base )
|
if ( !old_base )
|
||||||
return;
|
return;
|
||||||
|
@ -194,14 +222,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL_FUNC
|
LOCAL_FUNC
|
||||||
void T1_Release_Table( T1_Table* table )
|
void T1_Release_Table( T1_Table* table )
|
||||||
{
|
{
|
||||||
FT_Memory memory = table->memory;
|
FT_Memory memory = table->memory;
|
||||||
|
|
||||||
|
|
||||||
if ( table->init == (FT_Long)0xDEADBEEF )
|
if ( table->init == 0xDEADBEEFL )
|
||||||
{
|
{
|
||||||
FREE( table->block );
|
FREE( table->block );
|
||||||
FREE( table->elements );
|
FREE( table->elements );
|
||||||
|
@ -211,7 +238,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -220,6 +246,7 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' )
|
#define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' )
|
||||||
#define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' )
|
#define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' )
|
||||||
|
|
||||||
|
@ -266,7 +293,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL_FUNC
|
LOCAL_FUNC
|
||||||
void T1_ToToken( T1_Parser* parser,
|
void T1_ToToken( T1_Parser* parser,
|
||||||
T1_Token* token )
|
T1_Token* token )
|
||||||
|
@ -545,7 +571,7 @@
|
||||||
if ( cur >= limit )
|
if ( cur >= limit )
|
||||||
goto Exit;
|
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 */
|
/* be read */
|
||||||
c = *cur;
|
c = *cur;
|
||||||
ender = 0;
|
ender = 0;
|
||||||
|
@ -786,6 +812,7 @@
|
||||||
FT_Long val;
|
FT_Long val;
|
||||||
FT_String* string;
|
FT_String* string;
|
||||||
|
|
||||||
|
|
||||||
switch ( field->type )
|
switch ( field->type )
|
||||||
{
|
{
|
||||||
case t1_field_bool:
|
case t1_field_bool:
|
||||||
|
@ -824,6 +851,7 @@
|
||||||
FT_Memory memory = parser->memory;
|
FT_Memory memory = parser->memory;
|
||||||
FT_UInt len = limit-cur;
|
FT_UInt len = limit-cur;
|
||||||
|
|
||||||
|
|
||||||
if ( *(FT_String**)q )
|
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;
|
break;
|
||||||
|
@ -916,7 +944,7 @@
|
||||||
|
|
||||||
|
|
||||||
LOCAL_FUNC
|
LOCAL_FUNC
|
||||||
FT_Long T1_ToInt ( T1_Parser* parser )
|
FT_Long T1_ToInt( T1_Parser* parser )
|
||||||
{
|
{
|
||||||
return t1_toint( &parser->cursor, parser->limit );
|
return t1_toint( &parser->cursor, parser->limit );
|
||||||
}
|
}
|
||||||
|
@ -986,9 +1014,10 @@
|
||||||
LOCAL_FUNC
|
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* p1 = outline->points + first;
|
||||||
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
||||||
|
|
||||||
|
|
||||||
if ( outline->n_contours > 1 )
|
if ( outline->n_contours > 1 )
|
||||||
{
|
{
|
||||||
first = outline->contours[outline->n_contours - 2] + 1;
|
first = outline->contours[outline->n_contours - 2] + 1;
|
||||||
|
@ -1208,7 +1238,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -1218,10 +1247,6 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LOCAL_FUNC
|
LOCAL_FUNC
|
||||||
void T1_Decrypt( FT_Byte* buffer,
|
void T1_Decrypt( FT_Byte* buffer,
|
||||||
FT_Int length,
|
FT_Int length,
|
||||||
|
@ -1240,5 +1265,4 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
||||||
|
|
||||||
|
|
|
@ -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
|
#ifndef PSOBJS_H
|
||||||
#define PSOBJS_H
|
#define PSOBJS_H
|
||||||
|
|
||||||
#include <freetype/internal/psaux.h>
|
#include <freetype/internal/psaux.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -31,7 +54,6 @@
|
||||||
void T1_Release_Table( T1_Table* table );
|
void T1_Release_Table( T1_Table* table );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -72,7 +94,7 @@
|
||||||
FT_ULong* pflags );
|
FT_ULong* pflags );
|
||||||
|
|
||||||
LOCAL_DEF
|
LOCAL_DEF
|
||||||
FT_Long T1_ToInt ( T1_Parser* parser );
|
FT_Long T1_ToInt( T1_Parser* parser );
|
||||||
|
|
||||||
|
|
||||||
LOCAL_DEF
|
LOCAL_DEF
|
||||||
|
@ -102,12 +124,18 @@
|
||||||
void T1_Done_Parser( T1_Parser* parser )
|
void T1_Done_Parser( T1_Parser* parser )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
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 );
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* PSOBJS_H */
|
#endif /* PSOBJS_H */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
||||||
|
|
|
@ -1080,14 +1080,14 @@
|
||||||
(void)Z1_ToFixedArray( parser, 6, temp, 3 );
|
(void)Z1_ToFixedArray( parser, 6, temp, 3 );
|
||||||
|
|
||||||
/* we need to scale the values by 1.0/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[0] = FT_DivFix( temp[0], temp[3] );
|
||||||
temp[1] = FT_DivFix( temp[1], temp[3] );
|
temp[1] = FT_DivFix( temp[1], temp[3] );
|
||||||
temp[2] = FT_DivFix( temp[2], temp[3] );
|
temp[2] = FT_DivFix( temp[2], temp[3] );
|
||||||
temp[4] = FT_DivFix( temp[4], temp[3] );
|
temp[4] = FT_DivFix( temp[4], temp[3] );
|
||||||
temp[5] = FT_DivFix( temp[5], temp[3] );
|
temp[5] = FT_DivFix( temp[5], temp[3] );
|
||||||
temp[3] = 0x10000;
|
temp[3] = 0x10000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
matrix->xx = temp[0];
|
matrix->xx = temp[0];
|
||||||
|
|
Loading…
Reference in New Issue