[psaux] Formatting, minor fixes, whitespace, copyright notices.

This commit is contained in:
Werner Lemberg 2017-10-01 01:39:27 +02:00
parent 9b549fa69a
commit 179caf5a61
21 changed files with 907 additions and 826 deletions

View File

@ -4,7 +4,14 @@
/* */
/* PostScript CFF (Type 2) decoding routines (body). */
/* */
/* Copyright notice here. */
/* Copyright 2017 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. */
/* */
/***************************************************************************/
@ -190,6 +197,7 @@
2 /* setcurrentpoint */
};
static FT_Error
cff_operator_seac( CFF_Decoder* decoder,
FT_Pos asb,
@ -201,7 +209,7 @@
FT_Error error;
CFF_Builder* builder = &decoder->builder;
FT_Int bchar_index, achar_index;
TT_Face face = decoder->builder.face;
TT_Face face = decoder->builder.face;
FT_Vector left_bearing, advance;
FT_Byte* charstring;
FT_ULong charstring_len;
@ -342,7 +350,6 @@
return error;
}
#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
@ -401,8 +408,10 @@
{
FT_UInt n;
FT_UShort glyph_sid;
FT_Service_CFFLoad cffload;
/* CID-keyed fonts don't have glyph names */
if ( !cff->charset.sids )
return -1;
@ -414,14 +423,14 @@
#if 0
/* retrieve cffload from list of current modules */
FT_Service_CFFLoad cffload;
FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
if ( !cffload )
{
FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
if ( !cffload )
{
FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:"
" the `cffload' module is not available\n" ));
return FT_THROW( Unimplemented_Feature );
}
FT_ERROR(( "cff_lookup_glyph_by_stdcharcode:"
" the `cffload' module is not available\n" ));
return FT_THROW( Unimplemented_Feature );
}
#endif
@ -439,6 +448,7 @@
return -1;
}
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
/*************************************************************************/
@ -483,7 +493,7 @@
FT_UShort num_axes =
decoder->cff->top_font.font_dict.num_axes;
T2_Hints_Funcs hinter;
T2_Hints_Funcs hinter;
/* set default width */
@ -564,7 +574,7 @@
( (FT_UInt32)ip[1] << 16 ) |
( (FT_UInt32)ip[2] << 8 ) |
(FT_UInt32)ip[3] );
ip += 4;
ip += 4;
if ( charstring_type == 2 )
shift = 0;
}
@ -630,119 +640,117 @@
op = cff_op_return;
break;
case 12:
{
if ( ip >= limit )
goto Syntax_Error;
v = *ip++;
if ( ip >= limit )
goto Syntax_Error;
v = *ip++;
switch ( v )
{
case 0:
op = cff_op_dotsection;
break;
case 1: /* this is actually the Type1 vstem3 operator */
op = cff_op_vstem;
break;
case 2: /* this is actually the Type1 hstem3 operator */
op = cff_op_hstem;
break;
case 3:
op = cff_op_and;
break;
case 4:
op = cff_op_or;
break;
case 5:
op = cff_op_not;
break;
case 6:
op = cff_op_seac;
break;
case 7:
op = cff_op_sbw;
break;
case 8:
op = cff_op_store;
break;
case 9:
op = cff_op_abs;
break;
case 10:
op = cff_op_add;
break;
case 11:
op = cff_op_sub;
break;
case 12:
op = cff_op_div;
break;
case 13:
op = cff_op_load;
break;
case 14:
op = cff_op_neg;
break;
case 15:
op = cff_op_eq;
break;
case 16:
op = cff_op_callothersubr;
break;
case 17:
op = cff_op_pop;
break;
case 18:
op = cff_op_drop;
break;
case 20:
op = cff_op_put;
break;
case 21:
op = cff_op_get;
break;
case 22:
op = cff_op_ifelse;
break;
case 23:
op = cff_op_random;
break;
case 24:
op = cff_op_mul;
break;
case 26:
op = cff_op_sqrt;
break;
case 27:
op = cff_op_dup;
break;
case 28:
op = cff_op_exch;
break;
case 29:
op = cff_op_index;
break;
case 30:
op = cff_op_roll;
break;
case 33:
op = cff_op_setcurrentpoint;
break;
case 34:
op = cff_op_hflex;
break;
case 35:
op = cff_op_flex;
break;
case 36:
op = cff_op_hflex1;
break;
case 37:
op = cff_op_flex1;
break;
default:
FT_TRACE4(( " unknown op (12, %d)\n", v ));
break;
}
switch ( v )
{
case 0:
op = cff_op_dotsection;
break;
case 1: /* this is actually the Type1 vstem3 operator */
op = cff_op_vstem;
break;
case 2: /* this is actually the Type1 hstem3 operator */
op = cff_op_hstem;
break;
case 3:
op = cff_op_and;
break;
case 4:
op = cff_op_or;
break;
case 5:
op = cff_op_not;
break;
case 6:
op = cff_op_seac;
break;
case 7:
op = cff_op_sbw;
break;
case 8:
op = cff_op_store;
break;
case 9:
op = cff_op_abs;
break;
case 10:
op = cff_op_add;
break;
case 11:
op = cff_op_sub;
break;
case 12:
op = cff_op_div;
break;
case 13:
op = cff_op_load;
break;
case 14:
op = cff_op_neg;
break;
case 15:
op = cff_op_eq;
break;
case 16:
op = cff_op_callothersubr;
break;
case 17:
op = cff_op_pop;
break;
case 18:
op = cff_op_drop;
break;
case 20:
op = cff_op_put;
break;
case 21:
op = cff_op_get;
break;
case 22:
op = cff_op_ifelse;
break;
case 23:
op = cff_op_random;
break;
case 24:
op = cff_op_mul;
break;
case 26:
op = cff_op_sqrt;
break;
case 27:
op = cff_op_dup;
break;
case 28:
op = cff_op_exch;
break;
case 29:
op = cff_op_index;
break;
case 30:
op = cff_op_roll;
break;
case 33:
op = cff_op_setcurrentpoint;
break;
case 34:
op = cff_op_hflex;
break;
case 35:
op = cff_op_flex;
break;
case 36:
op = cff_op_hflex1;
break;
case 37:
op = cff_op_flex1;
break;
default:
FT_TRACE4(( " unknown op (12, %d)\n", v ));
break;
}
break;
case 13:
@ -984,7 +992,7 @@
#ifdef FT_DEBUG_LEVEL_TRACE
{
FT_UInt maskbyte;
FT_UInt maskbyte;
FT_TRACE4(( " (maskbytes:" ));
@ -1386,7 +1394,7 @@
case cff_op_hflex1:
{
FT_Pos start_y;
FT_Pos start_y;
FT_TRACE4(( " hflex1\n" ));
@ -1437,7 +1445,7 @@
case cff_op_hflex:
{
FT_Pos start_y;
FT_Pos start_y;
FT_TRACE4(( " hflex\n" ));
@ -1577,19 +1585,19 @@
break;
case cff_op_seac:
FT_TRACE4(( " seac\n" ));
FT_TRACE4(( " seac\n" ));
error = cff_operator_seac( decoder,
args[0], args[1], args[2],
(FT_Int)( args[3] >> 16 ),
(FT_Int)( args[4] >> 16 ) );
error = cff_operator_seac( decoder,
args[0], args[1], args[2],
(FT_Int)( args[3] >> 16 ),
(FT_Int)( args[4] >> 16 ) );
/* add current outline to the glyph slot */
FT_GlyphLoader_Add( builder->loader );
/* add current outline to the glyph slot */
FT_GlyphLoader_Add( builder->loader );
/* return now! */
FT_TRACE4(( "\n" ));
return error;
/* return now! */
FT_TRACE4(( "\n" ));
return error;
case cff_op_endchar:
/* in dictionaries, `endchar' simply indicates end of data */
@ -1813,7 +1821,7 @@
FT_TRACE4(( " dup\n" ));
args[1] = args[0];
args += 2;
args += 2;
break;
case cff_op_put:
@ -1855,7 +1863,7 @@
/* since we currently don't handle interpolation of multiple */
/* master fonts, this is a no-op */
FT_TRACE4(( " store\n"));
FT_TRACE4(( " store\n" ));
break;
case cff_op_load:
@ -2253,12 +2261,12 @@
/* hint_mode :: The hinting mode. */
/* */
FT_LOCAL_DEF( void )
cff_decoder_init( CFF_Decoder* decoder,
TT_Face face,
CFF_Size size,
CFF_GlyphSlot slot,
FT_Bool hinting,
FT_Render_Mode hint_mode,
cff_decoder_init( CFF_Decoder* decoder,
TT_Face face,
CFF_Size size,
CFF_GlyphSlot slot,
FT_Bool hinting,
FT_Render_Mode hint_mode,
CFF_Decoder_Get_Glyph_Callback get_callback,
CFF_Decoder_Free_Glyph_Callback free_callback )
{
@ -2279,7 +2287,7 @@
cff->top_font.font_dict.charstring_type,
decoder->num_globals );
decoder->hint_mode = hint_mode;
decoder->hint_mode = hint_mode;
decoder->get_glyph_callback = get_callback;
decoder->free_glyph_callback = free_callback;
@ -2300,10 +2308,12 @@
FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)cff->cffload;
/* manage CID fonts */
if ( cff->num_subfonts )
{
FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select, glyph_index );
FT_Byte fd_index = cffload->fd_select_get( &cff->fd_select,
glyph_index );
if ( fd_index >= cff->num_subfonts )
@ -2328,11 +2338,11 @@
}
}
decoder->num_locals = sub->local_subrs_index.count;
decoder->locals = sub->local_subrs;
decoder->locals_bias = cff_compute_bias(
decoder->cff->top_font.font_dict.charstring_type,
decoder->num_locals );
decoder->num_locals = sub->local_subrs_index.count;
decoder->locals = sub->local_subrs;
decoder->locals_bias = cff_compute_bias(
decoder->cff->top_font.font_dict.charstring_type,
decoder->num_locals );
decoder->glyph_width = sub->private_dict.default_width;
decoder->nominal_width = sub->private_dict.nominal_width;
@ -2342,3 +2352,6 @@
Exit:
return error;
}
/* END */

View File

@ -4,7 +4,14 @@
/* */
/* PostScript CFF (Type 2) decoding routines (specification). */
/* */
/* Copyright notice here. */
/* Copyright 2017 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. */
/* */
/***************************************************************************/
@ -19,14 +26,14 @@
FT_BEGIN_HEADER
FT_LOCAL( void )
cff_decoder_init( CFF_Decoder* decoder,
TT_Face face,
CFF_Size size,
CFF_GlyphSlot slot,
FT_Bool hinting,
FT_Render_Mode hint_mode,
cff_decoder_init( CFF_Decoder* decoder,
TT_Face face,
CFF_Size size,
CFF_GlyphSlot slot,
FT_Bool hinting,
FT_Render_Mode hint_mode,
CFF_Decoder_Get_Glyph_Callback get_callback,
CFF_Decoder_Free_Glyph_Callback free_callback);
CFF_Decoder_Free_Glyph_Callback free_callback );
FT_LOCAL( FT_Error )
cff_decoder_prepare( CFF_Decoder* decoder,
@ -39,13 +46,13 @@ FT_BEGIN_HEADER
FT_Int charcode );
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
FT_LOCAL( FT_Error )
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
FT_Byte* charstring_base,
FT_ULong charstring_len,
FT_Bool in_dict );
#endif
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
FT_LOCAL( FT_Error )
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
FT_Byte* charstring_base,
FT_ULong charstring_len,
FT_Bool in_dict );
#endif
FT_END_HEADER

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2ARRST_H_
#define CF2ARRST_H_
#ifndef PSARRST_H_
#define PSARRST_H_
#include "pserror.h"
@ -94,7 +94,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2ARRST_H_ */
#endif /* PSARRST_H_ */
/* END */

View File

@ -87,10 +87,10 @@
FT_CALLBACK_TABLE_DEF
const T1_Decoder_FuncsRec t1_decoder_funcs =
{
t1_decoder_init, /* init */
t1_decoder_done, /* done */
t1_decoder_parse_charstrings, /* parse_charstrings_old */
cf2_decoder_parse_charstrings /* parse_charstrings */
t1_decoder_init, /* init */
t1_decoder_done, /* done */
t1_decoder_parse_charstrings, /* parse_charstrings_old */
cf2_decoder_parse_charstrings /* parse_charstrings */
};
@ -133,13 +133,13 @@
FT_CALLBACK_TABLE_DEF
const CFF_Decoder_FuncsRec cff_decoder_funcs =
{
cff_decoder_init, /* init */
cff_decoder_prepare, /* prepare */
cff_decoder_init, /* init */
cff_decoder_prepare, /* prepare */
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
cff_decoder_parse_charstrings, /* parse_charstrings_old */
#endif
cf2_decoder_parse_charstrings /* parse_charstrings */
cf2_decoder_parse_charstrings /* parse_charstrings */
};

View File

@ -65,8 +65,8 @@
*/
#ifndef CF2BLUES_H_
#define CF2BLUES_H_
#ifndef PSBLUES_H_
#define PSBLUES_H_
#include "psglue.h"
@ -179,7 +179,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2BLUES_H_ */
#endif /* PSBLUES_H_ */
/* END */

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2ERROR_H_
#define CF2ERROR_H_
#ifndef PSERROR_H_
#define PSERROR_H_
#include FT_MODULE_ERRORS_H
@ -113,7 +113,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2ERROR_H_ */
#endif /* PSERROR_H_ */
/* END */

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2FIXED_H_
#define CF2FIXED_H_
#ifndef PSFIXED_H_
#define PSFIXED_H_
FT_BEGIN_HEADER
@ -89,7 +89,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2FIXED_H_ */
#endif /* PSFIXED_H_ */
/* END */

View File

@ -275,6 +275,8 @@
if ( !font->isT1 )
{
FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload;
/* check for variation vectors */
vstore = cf2_getVStore( decoder );
hasVariations = ( vstore->dataCount != 0 );

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2FONT_H_
#define CF2FONT_H_
#ifndef PSFONT_H_
#define PSFONT_H_
#include FT_SERVICE_CFF_TABLE_LOAD_H
@ -114,7 +114,7 @@ FT_BEGIN_HEADER
CF2_BluesRec blues; /* computed zone data */
FT_Service_CFFLoad cffload; /* Pointer to cff functions */
FT_Service_CFFLoad cffload; /* pointer to cff functions */
};
@ -128,7 +128,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2FONT_H_ */
#endif /* PSFONT_H_ */
/* END */

View File

@ -49,6 +49,7 @@
#include FT_SERVICE_CFF_TABLE_LOAD_H
#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
@ -479,15 +480,16 @@
CF2_UInt *len,
FT_Fixed* *vec )
{
TT_Face face;
TT_Face face;
FT_Service_MultiMasters mm;
FT_ASSERT( decoder && decoder->builder.face );
FT_ASSERT( vec && len );
FT_ASSERT( !decoder->builder.is_t1 );
face = (TT_Face)decoder->builder.face;
mm = (FT_Service_MultiMasters)face->mm;
mm = (FT_Service_MultiMasters)face->mm;
return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL );
}
@ -498,8 +500,8 @@
FT_LOCAL_DEF( CF2_Fixed )
cf2_getPpemY( PS_Decoder* decoder )
{
FT_ASSERT( decoder &&
decoder->builder.face &&
FT_ASSERT( decoder &&
decoder->builder.face &&
decoder->builder.face->size );
/*
@ -723,8 +725,10 @@
T1_Font type1 = &face->type1;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Incremental_InterfaceRec *inc =
FT_Incremental_InterfaceRec *inc =
face->root.internal->incremental_interface;
/* For incremental fonts get the character data using the */
/* callback function. */
if ( inc )
@ -732,7 +736,7 @@
glyph_index, &glyph_data );
else
#endif
/* For ordinary fonts get the character data stored in the face record. */
/* For ordinary fonts get the character data stored in the face record. */
{
glyph_data.pointer = type1->charstrings[glyph_index];
glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index];
@ -806,13 +810,13 @@
/* The CID driver stores subroutines with seed bytes. This */
/* case is taken care of when decoder->subrs_len == 0. */
if ( decoder->locals_len )
buf->end = buf->start + decoder->locals_len[idx];
buf->end = buf->start + decoder->locals_len[idx];
else
{
/* We are using subroutines from a CID font. We must adjust */
/* for the seed bytes. */
buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
buf->end = decoder->locals[idx + 1];
buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
buf->end = decoder->locals[idx + 1];
}
if ( !buf->start )
@ -823,7 +827,7 @@
}
else
{
buf->end = decoder->locals[idx + 1];
buf->end = decoder->locals[idx + 1];
}
buf->ptr = buf->start;

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2FT_H_
#define CF2FT_H_
#ifndef PSFT_H_
#define PSFT_H_
#include "pstypes.h"
@ -161,7 +161,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2FT_H_ */
#endif /* PSFT_H_ */
/* END */

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2GLUE_H_
#define CF2GLUE_H_
#ifndef PSGLUE_H_
#define PSGLUE_H_
/* common includes for other modules */
@ -138,7 +138,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2GLUE_H_ */
#endif /* PSGLUE_H_ */
/* END */

View File

@ -312,10 +312,11 @@
{
CF2_Hint hint = &hintmap->edge[i];
FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n",
hint->index,
hint->csCoord / 65536.0,
hint->dsCoord / (hint->scale * 1.0),
hint->dsCoord / ( hint->scale * 1.0 ),
hint->scale,
( cf2_hint_isPair( hint ) ? "p" : "g" ),
( cf2_hint_isTop( hint ) ? "t" : "b" ),
@ -645,9 +646,9 @@
firstHintEdge->csCoord / 65536.0,
firstHintEdge->dsCoord / 65536.0 ));
if ( isPair )
FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
secondHintEdge->csCoord / 65536.0,
secondHintEdge->dsCoord / 65536.0 ));
FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
secondHintEdge->csCoord / 65536.0,
secondHintEdge->dsCoord / 65536.0 ));
/*
* Discard any hints that overlap in character space. Most often, this
@ -767,6 +768,7 @@
/* insert first edge */
hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
hintmap->count += 1;
FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
firstHintEdge->csCoord / 65536.0,
firstHintEdge->dsCoord / 65536.0 ));
@ -776,6 +778,7 @@
/* insert second edge */
hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
hintmap->count += 1;
FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
secondHintEdge->csCoord / 65536.0,
secondHintEdge->dsCoord / 65536.0 ));

View File

@ -36,9 +36,8 @@
/***************************************************************************/
#ifndef CF2HINTS_H_
#define CF2HINTS_H_
#ifndef PSHINT_H_
#define PSHINT_H_
FT_BEGIN_HEADER
@ -283,7 +282,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2HINTS_H_ */
#endif /* PSHINT_H_ */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2INTRP_H_
#define CF2INTRP_H_
#ifndef PSINTRP_H_
#define PSINTRP_H_
#include "psft.h"
@ -77,7 +77,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2INTRP_H_ */
#endif /* PSINTRP_H_ */
/* END */

View File

@ -2064,53 +2064,55 @@
{
T1_Builder t1builder = (T1_Builder)builder;
ps_builder->memory = t1builder->memory;
ps_builder->face = (FT_Face)t1builder->face;
ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
ps_builder->loader = t1builder->loader;
ps_builder->base = t1builder->base;
ps_builder->current = t1builder->current;
ps_builder->pos_x = &t1builder->pos_x;
ps_builder->pos_y = &t1builder->pos_y;
ps_builder->memory = t1builder->memory;
ps_builder->face = (FT_Face)t1builder->face;
ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
ps_builder->loader = t1builder->loader;
ps_builder->base = t1builder->base;
ps_builder->current = t1builder->current;
ps_builder->left_bearing = &t1builder->left_bearing;
ps_builder->advance = &t1builder->advance;
ps_builder->pos_x = &t1builder->pos_x;
ps_builder->pos_y = &t1builder->pos_y;
ps_builder->bbox = &t1builder->bbox;
ps_builder->path_begun = 0;
ps_builder->load_points = t1builder->load_points;
ps_builder->no_recurse = t1builder->no_recurse;
ps_builder->left_bearing = &t1builder->left_bearing;
ps_builder->advance = &t1builder->advance;
ps_builder->metrics_only = t1builder->metrics_only;
ps_builder->bbox = &t1builder->bbox;
ps_builder->path_begun = 0;
ps_builder->load_points = t1builder->load_points;
ps_builder->no_recurse = t1builder->no_recurse;
ps_builder->metrics_only = t1builder->metrics_only;
}
else
{
CFF_Builder* cffbuilder = (CFF_Builder*)builder;
ps_builder->memory = cffbuilder->memory;
ps_builder->face = (FT_Face)cffbuilder->face;
ps_builder->glyph = cffbuilder->glyph;
ps_builder->loader = cffbuilder->loader;
ps_builder->base = cffbuilder->base;
ps_builder->current = cffbuilder->current;
ps_builder->pos_x = &cffbuilder->pos_x;
ps_builder->pos_y = &cffbuilder->pos_y;
ps_builder->memory = cffbuilder->memory;
ps_builder->face = (FT_Face)cffbuilder->face;
ps_builder->glyph = cffbuilder->glyph;
ps_builder->loader = cffbuilder->loader;
ps_builder->base = cffbuilder->base;
ps_builder->current = cffbuilder->current;
ps_builder->left_bearing = &cffbuilder->left_bearing;
ps_builder->advance = &cffbuilder->advance;
ps_builder->pos_x = &cffbuilder->pos_x;
ps_builder->pos_y = &cffbuilder->pos_y;
ps_builder->bbox = &cffbuilder->bbox;
ps_builder->path_begun = cffbuilder->path_begun;
ps_builder->load_points = cffbuilder->load_points;
ps_builder->no_recurse = cffbuilder->no_recurse;
ps_builder->left_bearing = &cffbuilder->left_bearing;
ps_builder->advance = &cffbuilder->advance;
ps_builder->metrics_only = cffbuilder->metrics_only;
ps_builder->bbox = &cffbuilder->bbox;
ps_builder->path_begun = cffbuilder->path_begun;
ps_builder->load_points = cffbuilder->load_points;
ps_builder->no_recurse = cffbuilder->no_recurse;
ps_builder->metrics_only = cffbuilder->metrics_only;
}
ps_builder->is_t1 = is_t1;
ps_builder->funcs = ps_builder_funcs;
ps_builder->is_t1 = is_t1;
ps_builder->funcs = ps_builder_funcs;
}
@ -2164,6 +2166,7 @@
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
if ( !builder->is_t1 &&
driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
@ -2219,7 +2222,7 @@
/* this might happen in invalid fonts */
if ( !outline )
{
FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
FT_ERROR(( "ps_builder_add_contour: no outline to add points to\n" ));
return FT_THROW( Invalid_File_Format );
}
@ -2356,61 +2359,63 @@
{
T1_Decoder t1_decoder = (T1_Decoder)decoder;
ps_builder_init( &ps_decoder->builder,
&t1_decoder->builder,
is_t1 );
ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
ps_decoder->psnames = t1_decoder->psnames;
ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
ps_decoder->psnames = t1_decoder->psnames;
ps_decoder->num_glyphs = t1_decoder->num_glyphs;
ps_decoder->glyph_names = t1_decoder->glyph_names;
ps_decoder->hint_mode = t1_decoder->hint_mode;
ps_decoder->blend = t1_decoder->blend;
ps_decoder->num_glyphs = t1_decoder->num_glyphs;
ps_decoder->glyph_names = t1_decoder->glyph_names;
ps_decoder->hint_mode = t1_decoder->hint_mode;
ps_decoder->blend = t1_decoder->blend;
ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs;
ps_decoder->locals = t1_decoder->subrs;
ps_decoder->locals_len = t1_decoder->subrs_len;
ps_decoder->locals_hash = t1_decoder->subrs_hash;
ps_decoder->num_locals = (FT_UInt)t1_decoder->num_subrs;
ps_decoder->locals = t1_decoder->subrs;
ps_decoder->locals_len = t1_decoder->subrs_len;
ps_decoder->locals_hash = t1_decoder->subrs_hash;
ps_decoder->buildchar = t1_decoder->buildchar;
ps_decoder->len_buildchar = t1_decoder->len_buildchar;
ps_decoder->buildchar = t1_decoder->buildchar;
ps_decoder->len_buildchar = t1_decoder->len_buildchar;
ps_decoder->lenIV = t1_decoder->lenIV;
ps_decoder->lenIV = t1_decoder->lenIV;
}
else
{
CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
ps_builder_init( &ps_decoder->builder,
&cff_decoder->builder,
is_t1 );
ps_decoder->cff = cff_decoder->cff;
ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
ps_decoder->current_subfont = cff_decoder->current_subfont;
ps_decoder->cff = cff_decoder->cff;
ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
ps_decoder->current_subfont = cff_decoder->current_subfont;
ps_decoder->num_globals = cff_decoder->num_globals;
ps_decoder->globals = cff_decoder->globals;
ps_decoder->globals_bias = cff_decoder->globals_bias;
ps_decoder->num_locals = cff_decoder->num_locals;
ps_decoder->locals = cff_decoder->locals;
ps_decoder->locals_bias = cff_decoder->locals_bias;
ps_decoder->num_globals = cff_decoder->num_globals;
ps_decoder->globals = cff_decoder->globals;
ps_decoder->globals_bias = cff_decoder->globals_bias;
ps_decoder->num_locals = cff_decoder->num_locals;
ps_decoder->locals = cff_decoder->locals;
ps_decoder->locals_bias = cff_decoder->locals_bias;
ps_decoder->glyph_width = cff_decoder->glyph_width;
ps_decoder->nominal_width = cff_decoder->nominal_width;
ps_decoder->width_only = cff_decoder->width_only;
ps_decoder->glyph_width = cff_decoder->glyph_width;
ps_decoder->nominal_width = cff_decoder->nominal_width;
ps_decoder->width_only = cff_decoder->width_only;
ps_decoder->hint_mode = cff_decoder->hint_mode;
ps_decoder->hint_mode = cff_decoder->hint_mode;
ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
}
}
/* Synthesize a SubFont object for Type 1 fonts, for use in the */
/* new interpreter to access Private dict data */
/* new interpreter to access Private dict data. */
FT_LOCAL_DEF( void )
t1_make_subfont( FT_Face face,
PS_Private priv,
@ -2419,6 +2424,7 @@
CFF_Private cpriv = &subfont->private_dict;
FT_UInt n, count;
FT_ZERO( subfont );
FT_ZERO( cpriv );
@ -2442,8 +2448,8 @@
cpriv->blue_shift = (FT_Pos)priv->blue_shift;
cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
cpriv->standard_width = (FT_Pos)priv->standard_width[0];
cpriv->standard_height = (FT_Pos)priv->standard_height[0];
cpriv->standard_width = (FT_Pos)priv->standard_width[0];
cpriv->standard_height = (FT_Pos)priv->standard_height[0];
count = cpriv->num_snap_widths = priv->num_snap_widths;
for ( n = 0; n < count; n++ )
@ -2458,14 +2464,14 @@
cpriv->language_group = priv->language_group;
cpriv->expansion_factor = priv->expansion_factor;
cpriv->subfont = subfont;
cpriv->subfont = subfont;
/* Initialize the random number generator. */
if ( face->internal->random_seed != -1 )
{
/* . If we have a face-specific seed, use it. */
/* If non-zero, update it to a positive value. */
/* If we have a face-specific seed, use it. */
/* If non-zero, update it to a positive value. */
subfont->random = (FT_UInt32)face->internal->random_seed;
if ( face->internal->random_seed )
{
@ -2473,6 +2479,7 @@
{
face->internal->random_seed = (FT_Int32)cff_random(
(FT_UInt32)face->internal->random_seed );
} while ( face->internal->random_seed < 0 );
}
}
@ -2480,6 +2487,7 @@
{
FT_UInt32 seed;
/* compute random seed from some memory addresses */
seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
(FT_Offset)(char*)&face ^

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2READ_H_
#define CF2READ_H_
#ifndef PSREAD_H_
#define PSREAD_H_
FT_BEGIN_HEADER
@ -62,7 +62,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2READ_H_ */
#endif /* PSREAD_H_ */
/* END */

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2STACK_H_
#define CF2STACK_H_
#ifndef PSSTACK_H_
#define PSSTACK_H_
FT_BEGIN_HEADER
@ -115,7 +115,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2STACK_H_ */
#endif /* PSSTACK_H_ */
/* END */

View File

@ -36,8 +36,8 @@
/***************************************************************************/
#ifndef CF2TYPES_H_
#define CF2TYPES_H_
#ifndef PSTYPES_H_
#define PSTYPES_H_
#include <ft2build.h>
#include FT_FREETYPE_H
@ -72,7 +72,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
#endif /* CF2TYPES_H_ */
#endif /* PSTYPES_H_ */
/* END */

View File

@ -1692,6 +1692,7 @@
{
FT_Memory memory = decoder->builder.memory;
t1_builder_done( &decoder->builder );
if ( decoder->cf2_instance.finalizer )