forked from minhngoc25a/freetype2
[psaux] Add missing objects for Type 1. (1/2)
Move CF2_Font instance to PS_Decoder. This is the context for the interpreter and since it is currently stored in CFF_Font, is unavailable in Type 1 mode. * include/freetype/internal/psaux.h (T1_Decoder, PS_Decoder): Add the cf2_instance field. * src/psaux/psdecode.c (ps_decoder_init): Copy cf2_instance to PS_Decoder. Remove unused line. * src/psaux/t1decode.c (t1_decoder_done): Add finalization code. * src/psaux/psft.c: Update accesses.
This commit is contained in:
parent
e6d81a03fa
commit
b55214c820
|
@ -610,7 +610,8 @@ FT_BEGIN_HEADER
|
|||
|
||||
CFF_Font cff;
|
||||
CFF_SubFont current_subfont; /* for current glyph_index */
|
||||
|
||||
FT_Generic* cf2_instance;
|
||||
|
||||
FT_Pos glyph_width;
|
||||
FT_Pos nominal_width;
|
||||
|
||||
|
@ -636,7 +637,7 @@ FT_BEGIN_HEADER
|
|||
|
||||
CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
|
||||
CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
|
||||
|
||||
|
||||
/* Type 1 stuff */
|
||||
FT_Service_PsCMaps psnames; /* for seac */
|
||||
|
||||
|
@ -924,6 +925,8 @@ FT_BEGIN_HEADER
|
|||
|
||||
FT_Bool seac;
|
||||
|
||||
FT_Generic cf2_instance;
|
||||
|
||||
} T1_DecoderRec;
|
||||
|
||||
/*************************************************************************/
|
||||
|
|
|
@ -41,13 +41,13 @@
|
|||
is_t1,
|
||||
&ps_decoder->builder );
|
||||
|
||||
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->t1_parse_callback = t1_decoder->parse_callback; */
|
||||
|
||||
ps_decoder->num_locals = t1_decoder->num_subrs;
|
||||
ps_decoder->locals = t1_decoder->subrs;
|
||||
|
@ -68,6 +68,7 @@
|
|||
&ps_decoder->builder );
|
||||
|
||||
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;
|
||||
|
|
|
@ -318,19 +318,19 @@
|
|||
memory = decoder->builder.memory;
|
||||
|
||||
/* CF2 data is saved here across glyphs */
|
||||
font = (CF2_Font)decoder->cff->cf2_instance.data;
|
||||
font = (CF2_Font)decoder->cf2_instance->data;
|
||||
|
||||
/* on first glyph, allocate instance structure */
|
||||
if ( !decoder->cff->cf2_instance.data )
|
||||
if ( !decoder->cf2_instance->data )
|
||||
{
|
||||
decoder->cff->cf2_instance.finalizer =
|
||||
decoder->cf2_instance->finalizer =
|
||||
(FT_Generic_Finalizer)cf2_free_instance;
|
||||
|
||||
if ( FT_ALLOC( decoder->cff->cf2_instance.data,
|
||||
if ( FT_ALLOC( decoder->cf2_instance->data,
|
||||
sizeof ( CF2_FontRec ) ) )
|
||||
return FT_THROW( Out_Of_Memory );
|
||||
|
||||
font = (CF2_Font)decoder->cff->cf2_instance.data;
|
||||
font = (CF2_Font)decoder->cf2_instance->data;
|
||||
|
||||
font->memory = memory;
|
||||
|
||||
|
|
|
@ -1641,7 +1641,15 @@
|
|||
FT_LOCAL_DEF( void )
|
||||
t1_decoder_done( T1_Decoder decoder )
|
||||
{
|
||||
FT_Memory memory = decoder->builder.memory;
|
||||
|
||||
t1_builder_done( &decoder->builder );
|
||||
|
||||
if ( decoder->cf2_instance.finalizer )
|
||||
{
|
||||
decoder->cf2_instance.finalizer( decoder->cf2_instance.data );
|
||||
FT_FREE( decoder->cf2_instance.data );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue