[sfnt] Don't require 'gvar' table to support variation fonts.
Fixes #1172. * src/sfnt/sfobjs.c (sfnt_load_face): Tag font as Multiple Masters font if `fvar` is present; do not require other tables to be present. * src/truetype/ttgxvar.c (tt_set_mm_blend): Allow for a missing 'gvar' table when setting variation coordinates. However, if a 'gvar' table is actually present, do perform a sanity check and fail on malformedness. (TT_Get_MM_Var): Don't assume 'fvar' needs 'gvar' or 'CFF2 tables in all cases, which is an overly tight check.
This commit is contained in:
parent
dd91f6e7f5
commit
a1017e2655
|
@ -1107,13 +1107,7 @@
|
||||||
/* Don't bother to load the tables unless somebody asks for them. */
|
/* Don't bother to load the tables unless somebody asks for them. */
|
||||||
/* No need to do work which will (probably) not be used. */
|
/* No need to do work which will (probably) not be used. */
|
||||||
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
|
if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
|
||||||
{
|
|
||||||
if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
|
|
||||||
tt_face_lookup_table( face, TTAG_gvar ) != 0 )
|
|
||||||
flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
|
flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
|
||||||
if ( tt_face_lookup_table( face, TTAG_CFF2 ) != 0 )
|
|
||||||
flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
root->face_flags = flags;
|
root->face_flags = flags;
|
||||||
|
|
|
@ -2217,20 +2217,6 @@
|
||||||
{
|
{
|
||||||
FT_TRACE2(( "FVAR " ));
|
FT_TRACE2(( "FVAR " ));
|
||||||
|
|
||||||
/* both `fvar' and `gvar' must be present */
|
|
||||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_gvar,
|
|
||||||
stream, &table_len ) ) )
|
|
||||||
{
|
|
||||||
/* CFF2 is an alternate to gvar here */
|
|
||||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_CFF2,
|
|
||||||
stream, &table_len ) ) )
|
|
||||||
{
|
|
||||||
FT_TRACE1(( "\n" ));
|
|
||||||
FT_TRACE1(( "TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" ));
|
|
||||||
goto Exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar,
|
if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar,
|
||||||
stream, &table_len ) ) )
|
stream, &table_len ) ) )
|
||||||
{
|
{
|
||||||
|
@ -2673,8 +2659,16 @@
|
||||||
FT_TRACE5(( "\n" ));
|
FT_TRACE5(( "\n" ));
|
||||||
|
|
||||||
if ( !face->is_cff2 && !blend->glyphoffsets )
|
if ( !face->is_cff2 && !blend->glyphoffsets )
|
||||||
if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) )
|
{
|
||||||
|
/* While a missing 'gvar' table is acceptable, for example for */
|
||||||
|
/* fonts that only vary metrics information or 'COLR' v1 */
|
||||||
|
/* `PaintVar*` tables, an incorrect SFNT table offset or size */
|
||||||
|
/* for 'gvar', or an inconsistent 'gvar' table is not. */
|
||||||
|
error = ft_var_load_gvar( face );
|
||||||
|
if ( error != FT_Err_Table_Missing && error != FT_Err_Ok )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
error = FT_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !blend->coords )
|
if ( !blend->coords )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue