* src/truetype/ttgload.c (load_truetype_glyph): Save graphics state

before handling subglyphs so that it can be reinitialized each time.
This fixes Savannah bug #19859.
This commit is contained in:
Werner Lemberg 2007-05-19 07:01:49 +00:00
parent d069246805
commit 6f99c88801
2 changed files with 35 additions and 25 deletions

View File

@ -1,3 +1,9 @@
2007-05-19 Werner Lemberg <wl@gnu.org>
* src/truetype/ttgload.c (load_truetype_glyph): Save graphics state
before handling subglyphs so that it can be reinitialized each time.
This fixes Savannah bug #19859.
2007-05-16 Werner Lemberg <wl@gnu.org> 2007-05-16 Werner Lemberg <wl@gnu.org>
* src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink), * src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink),

View File

@ -1360,7 +1360,6 @@
/* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */ /* if the flag FT_LOAD_NO_RECURSE is set, we return the subglyph */
/* `as is' in the glyph slot (the client application will be */ /* `as is' in the glyph slot (the client application will be */
/* responsible for interpreting these data)... */ /* responsible for interpreting these data)... */
/* */
if ( loader->load_flags & FT_LOAD_NO_RECURSE ) if ( loader->load_flags & FT_LOAD_NO_RECURSE )
{ {
FT_GlyphLoader_Add( gloader ); FT_GlyphLoader_Add( gloader );
@ -1383,6 +1382,8 @@
FT_Stream old_stream = loader->stream; FT_Stream old_stream = loader->stream;
TT_GraphicsState saved_GS = loader->exec->GS;
FT_GlyphLoader_Add( gloader ); FT_GlyphLoader_Add( gloader );
@ -1392,6 +1393,9 @@
FT_Vector pp[4]; FT_Vector pp[4];
/* reinitialize graphics state */
loader->exec->GS = saved_GS;
/* Each time we call load_truetype_glyph in this loop, the */ /* Each time we call load_truetype_glyph in this loop, the */
/* value of `gloader.base.subglyphs' can change due to table */ /* value of `gloader.base.subglyphs' can change due to table */
/* reallocations. We thus need to recompute the subglyph */ /* reallocations. We thus need to recompute the subglyph */
@ -1426,10 +1430,10 @@
if ( num_points == num_base_points ) if ( num_points == num_base_points )
continue; continue;
/* gloader->base.outline consists of three part: */ /* gloader->base.outline consists of three parts: */
/* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */ /* 0 -(1)-> start_point -(2)-> num_base_points -(3)-> n_points. */
/* */ /* */
/* (1): exist from the beginning */ /* (1): exists from the beginning */
/* (2): components that have been loaded so far */ /* (2): components that have been loaded so far */
/* (3): the newly loaded component */ /* (3): the newly loaded component */
TT_Process_Composite_Component( loader, subglyph, start_point, TT_Process_Composite_Component( loader, subglyph, start_point,
@ -1455,7 +1459,7 @@
} }
else else
{ {
/* invalid composite count ( negative but not -1 ) */ /* invalid composite count (negative but not -1) */
error = TT_Err_Invalid_Outline; error = TT_Err_Invalid_Outline;
goto Exit; goto Exit;
} }
@ -1502,7 +1506,7 @@
else else
bbox = loader->bbox; bbox = loader->bbox;
/* get the device-independent horizontal advance. It is scaled later */ /* get the device-independent horizontal advance; it is scaled later */
/* by the base layer. */ /* by the base layer. */
{ {
FT_Pos advance = loader->linear; FT_Pos advance = loader->linear;
@ -1763,11 +1767,11 @@
tt_size_run_prep( size ); tt_size_run_prep( size );
} }
/* see if the cvt program has disabled hinting */ /* see whether the cvt program has disabled hinting */
if ( exec->GS.instruct_control & 1 ) if ( exec->GS.instruct_control & 1 )
load_flags |= FT_LOAD_NO_HINTING; load_flags |= FT_LOAD_NO_HINTING;
/* load default graphics state - if needed */ /* load default graphics state -- if needed */
if ( exec->GS.instruct_control & 2 ) if ( exec->GS.instruct_control & 2 )
exec->GS = tt_default_graphics_state; exec->GS = tt_default_graphics_state;
@ -1778,7 +1782,7 @@
#endif /* TT_USE_BYTECODE_INTERPRETER */ #endif /* TT_USE_BYTECODE_INTERPRETER */
/* seek to the beginning of the glyph table. For Type 42 fonts */ /* seek to the beginning of the glyph table -- for Type 42 fonts */
/* the table might be accessed from a Postscript stream or something */ /* the table might be accessed from a Postscript stream or something */
/* else... */ /* else... */
@ -1894,7 +1898,7 @@
glyph->num_subglyphs = 0; glyph->num_subglyphs = 0;
glyph->outline.flags = 0; glyph->outline.flags = 0;
/* Main loading loop */ /* main loading loop */
error = load_truetype_glyph( &loader, glyph_index, 0 ); error = load_truetype_glyph( &loader, glyph_index, 0 );
if ( !error ) if ( !error )
{ {