[cff] Fix Savannah bug #41363.

* src/cff/cf2ft.c (cf2_checkTransform): Convert assertion into
parameter check.
(cf2_decoder_parse_charstrings): Call `cf2_checkTransform' only if
we are scaling the outline.
(cf2_getPpemY): Remove problematic assertion.
This commit is contained in:
Werner Lemberg 2014-02-03 11:16:47 +01:00
parent f3abecb615
commit ee3778d3d7
2 changed files with 28 additions and 5 deletions

View File

@ -1,3 +1,13 @@
2014-02-03 Werner Lemberg <wl@gnu.org>
[cff] Fix Savannah bug #41363.
* src/cff/cf2ft.c (cf2_checkTransform): Convert assertion into
parameter check.
(cf2_decoder_parse_charstrings): Call `cf2_checkTransform' only if
we are scaling the outline.
(cf2_getPpemY): Remove problematic assertion.
2014-01-26 Werner Lemberg <wl@gnu.org> 2014-01-26 Werner Lemberg <wl@gnu.org>
[autofit] Introduce two more slots for standard characters. [autofit] Introduce two more slots for standard characters.

View File

@ -61,7 +61,9 @@
FT_ASSERT( unitsPerEm > 0 ); FT_ASSERT( unitsPerEm > 0 );
FT_ASSERT( transform->a > 0 && transform->d > 0 ); if ( transform->a <= 0 || transform->d <= 0 )
return FT_THROW( Invalid_Size_Handle );
FT_ASSERT( transform->b == 0 && transform->c == 0 ); FT_ASSERT( transform->b == 0 && transform->c == 0 );
FT_ASSERT( transform->tx == 0 && transform->ty == 0 ); FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
@ -357,9 +359,12 @@
/* also get units per em to validate scale */ /* also get units per em to validate scale */
font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder ); font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
error2 = cf2_checkTransform( &transform, font->unitsPerEm ); if ( scaled )
if ( error2 ) {
return error2; error2 = cf2_checkTransform( &transform, font->unitsPerEm );
if ( error2 )
return error2;
}
error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth ); error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
if ( error2 ) if ( error2 )
@ -389,8 +394,16 @@
FT_ASSERT( decoder && FT_ASSERT( decoder &&
decoder->builder.face && decoder->builder.face &&
decoder->builder.face->root.size ); decoder->builder.face->root.size );
FT_ASSERT( decoder->builder.face->root.size->metrics.y_ppem );
/*
* Note that `y_ppem' can be zero if there wasn't a call to
* `FT_Set_Char_Size' or something similar. However, this isn't a
* problem since we come to this place in the code only if
* FT_LOAD_NO_SCALE is set (the other case gets caught by
* `cf2_checkTransform'). The ppem value is needed to compute the stem
* darkening, which is disabled for getting the unscaled outline.
*
*/
return cf2_intToFixed( return cf2_intToFixed(
decoder->builder.face->root.size->metrics.y_ppem ); decoder->builder.face->root.size->metrics.y_ppem );
} }