diff options
Diffstat (limited to 'src/psaux/t1decode.c')
-rw-r--r-- | src/psaux/t1decode.c | 70 |
1 files changed, 38 insertions, 32 deletions
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 1c0b01476..a3ec4e36a 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -267,6 +267,9 @@ decoder->builder.left_bearing.x = 0; decoder->builder.left_bearing.y = 0; + decoder->builder.pos_x = adx - asb; + decoder->builder.pos_y = ady; + /* Now load `achar' on top of */ /* the base outline */ error = T1_Decoder_Parse_Glyph( decoder, achar_index ); @@ -279,17 +282,8 @@ decoder->builder.left_bearing = left_bearing; decoder->builder.advance = advance; - /* Finally, move the accent */ - if ( decoder->builder.load_points ) - { - FT_Outline dummy; - - - dummy.n_points = (short)( base->n_points - n_base_points ); - dummy.points = base->points + n_base_points; - - FT_Outline_Translate( &dummy, adx - asb, ady ); - } + decoder->builder.pos_x = 0; + decoder->builder.pos_y = 0; Exit: return error; @@ -343,7 +337,7 @@ builder->path_begun = 0; - hinter = builder->hints_funcs; + hinter = (T1_Hints_Funcs) builder->hints_funcs; zone->base = charstring_base; limit = zone->limit = charstring_base + charstring_len; @@ -722,7 +716,15 @@ /* close hints recording session */ if ( hinter ) - hinter->close( hinter->hints, builder->current->n_points ); + { + if (hinter->close( hinter->hints, builder->current->n_points )) + goto Syntax_Error; + + /* apply hints to the loaded glyph outline now */ + hinter->apply( hinter->hints, + builder->current, + (PSH_Globals) builder->hints_globals ); + } /* add current outline to the glyph slot */ FT_GlyphLoader_Add( builder->loader ); @@ -738,8 +740,8 @@ builder->advance.x = top[1]; builder->advance.y = 0; - builder->last.x = x = top[0]; - builder->last.y = y = 0; + builder->last.x = x = builder->pos_x + top[0]; + builder->last.y = y = builder->pos_y; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -762,8 +764,8 @@ builder->advance.x = top[2]; builder->advance.y = top[3]; - builder->last.x = x = top[0]; - builder->last.y = y = top[1]; + builder->last.x = x = builder->pos_x + top[0]; + builder->last.y = y = builder->pos_y + top[1]; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ @@ -1057,22 +1059,25 @@ } - FT_LOCAL_DEF - FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder, - FT_UInt glyph ) + /* parse a single Type 1 glyph */ + FT_LOCAL_DEF FT_Error + T1_Decoder_Parse_Glyph( T1_Decoder* decoder, + FT_UInt glyph ) { return decoder->parse_callback( decoder, glyph ); } - - FT_LOCAL_DEF - FT_Error T1_Decoder_Init( T1_Decoder* decoder, - FT_Face face, - FT_Size size, - FT_GlyphSlot slot, - FT_Byte** glyph_names, - T1_Blend* blend, - T1_Decoder_Callback parse_callback ) + + /* initialise T1 decoder */ + FT_LOCAL_DEF FT_Error + T1_Decoder_Init( T1_Decoder* decoder, + FT_Face face, + FT_Size size, + FT_GlyphSlot slot, + FT_Byte** glyph_names, + T1_Blend* blend, + FT_Bool hinting, + T1_Decoder_Callback parse_callback ) { MEM_Set( decoder, 0, sizeof ( *decoder ) ); @@ -1092,7 +1097,7 @@ decoder->psnames = psnames; } - T1_Builder_Init( &decoder->builder, face, size, slot ); + T1_Builder_Init( &decoder->builder, face, size, slot, hinting ); decoder->num_glyphs = face->num_glyphs; decoder->glyph_names = glyph_names; @@ -1105,8 +1110,9 @@ } - FT_LOCAL_DEF - void T1_Decoder_Done( T1_Decoder* decoder ) + /* finalize T1 decoder */ + FT_LOCAL_DEF void + T1_Decoder_Done( T1_Decoder* decoder ) { T1_Builder_Done( &decoder->builder ); } |