diff options
author | Ewald Hew <ewaldhew@gmail.com> | 2017-09-25 08:04:09 +0200 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2017-09-25 09:26:59 +0200 |
commit | d813b5da5994807fe2357eddae95bd6642e3e7bb (patch) | |
tree | 2c6246bb790ee045f66270bcfc9c42b283811f47 /src/psaux/psft.c | |
parent | d55a701de60f559d27f5106cddb50884fed00bf7 (diff) | |
download | freetype2-d813b5da5994807fe2357eddae95bd6642e3e7bb.tar.gz |
Extend Adobe interpreter (seac).
This concludes the changes needed to add Type 1 support.
* src/psaux/psintrp.c: Update includes.
(cf2_interpT2CharString) <cf2_escSEAC>: Implement this similarly to
implied seac for CFF.
* src/psaux/t1decode.c (t1_lookup_glyph_by_stdcharcode_ps): New
function to look up the glyph index.
* src/psaux/psft.c (cf2_getT1SeacComponent,
cf2_freeT1SeacComponent): New functions to get the charstrings for
seac components.
* src/psaux/t1decode.h, src/psaux/psft.h: Update declarations.
Diffstat (limited to 'src/psaux/psft.c')
-rw-r--r-- | src/psaux/psft.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/psaux/psft.c b/src/psaux/psft.c index 81d3fd835..b12d9d163 100644 --- a/src/psaux/psft.c +++ b/src/psaux/psft.c @@ -705,6 +705,74 @@ } + FT_LOCAL_DEF( FT_Error ) + cf2_getT1SeacComponent( PS_Decoder* decoder, + FT_UInt glyph_index, + CF2_Buffer buf ) + { + FT_Data glyph_data; + FT_Error error = FT_Err_Ok; + T1_Face face = (T1_Face)decoder->builder.face; + T1_Font type1 = &face->type1; + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + FT_Incremental_InterfaceRec *inc = + face->root.internal->incremental_interface; + /* For incremental fonts get the character data using the */ + /* callback function. */ + if ( inc ) + error = inc->funcs->get_glyph_data( inc->object, + glyph_index, &glyph_data ); + else +#endif + /* 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]; + } + + if ( !error ) + { + FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer; + FT_ULong charstring_len = (FT_ULong)glyph_data.length; + + + FT_ASSERT( charstring_base + charstring_len >= charstring_base ); + + FT_ZERO( buf ); + buf->start = + buf->ptr = charstring_base; + buf->end = charstring_base + charstring_len; + } + + return error; + } + + + FT_LOCAL_DEF( void ) + cf2_freeT1SeacComponent( PS_Decoder* decoder, + CF2_Buffer buf ) + { + T1_Face face; + FT_Data data; + + + FT_ASSERT( decoder ); + +#ifdef FT_CONFIG_OPTION_INCREMENTAL + face = (T1_Face)decoder->builder.face; + + data.pointer = buf->start; + data.length = (FT_Int)( buf->end - buf->start ); + + if ( face->root.internal->incremental_interface ) + face->root.internal->incremental_interface->funcs->free_glyph_data( + face->root.internal->incremental_interface->object, + &data ); +#endif /* FT_CONFIG_OPTION_INCREMENTAL */ + } + + FT_LOCAL_DEF( CF2_Int ) cf2_initLocalRegionBuffer( PS_Decoder* decoder, CF2_Int subrNum, |