freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] 2 commits: [sfnt] Don't require 'gvar'


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] 2 commits: [sfnt] Don't require 'gvar' table to support variation fonts.
Date: Mon, 05 Sep 2022 08:46:16 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • a1017e26
    by Dominik Röttsches at 2022-09-05T10:36:22+02:00
    [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.
    
  • 048f2e24
    by Werner Lemberg at 2022-09-05T10:43:59+02:00
    [autofit] Minor fix.
    
    * src/autofit/afglobal.c (af_face_globals_compute_style_coverage): Avoid
    compiler warning.
    

3 changed files:

Changes:

  • src/autofit/afglobal.c
    ... ... @@ -301,7 +301,7 @@
    301 301
               if ( !( count % 10 ) )
    
    302 302
                 FT_TRACE4(( " " ));
    
    303 303
     
    
    304
    -          FT_TRACE4(( " %ld", idx ));
    
    304
    +          FT_TRACE4(( " %d", idx ));
    
    305 305
               count++;
    
    306 306
     
    
    307 307
               if ( !( count % 10 ) )
    

  • src/sfnt/sfobjs.c
    ... ... @@ -1107,13 +1107,7 @@
    1107 1107
           /* Don't bother to load the tables unless somebody asks for them. */
    
    1108 1108
           /* No need to do work which will (probably) not be used.          */
    
    1109 1109
           if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
    
    1110
    -      {
    
    1111
    -        if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
    
    1112
    -             tt_face_lookup_table( face, TTAG_gvar ) != 0 )
    
    1113
    -          flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
    
    1114
    -        if ( tt_face_lookup_table( face, TTAG_CFF2 ) != 0 )
    
    1115
    -          flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
    
    1116
    -      }
    
    1110
    +        flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
    
    1117 1111
     #endif
    
    1118 1112
     
    
    1119 1113
           root->face_flags = flags;
    

  • src/truetype/ttgxvar.c
    ... ... @@ -2217,20 +2217,6 @@
    2217 2217
         {
    
    2218 2218
           FT_TRACE2(( "FVAR " ));
    
    2219 2219
     
    
    2220
    -      /* both `fvar' and `gvar' must be present */
    
    2221
    -      if ( FT_SET_ERROR( face->goto_table( face, TTAG_gvar,
    
    2222
    -                                           stream, &table_len ) ) )
    
    2223
    -      {
    
    2224
    -        /* CFF2 is an alternate to gvar here */
    
    2225
    -        if ( FT_SET_ERROR( face->goto_table( face, TTAG_CFF2,
    
    2226
    -                                             stream, &table_len ) ) )
    
    2227
    -        {
    
    2228
    -          FT_TRACE1(( "\n" ));
    
    2229
    -          FT_TRACE1(( "TT_Get_MM_Var: `gvar' or `CFF2' table is missing\n" ));
    
    2230
    -          goto Exit;
    
    2231
    -        }
    
    2232
    -      }
    
    2233
    -
    
    2234 2220
           if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar,
    
    2235 2221
                                                stream, &table_len ) ) )
    
    2236 2222
           {
    
    ... ... @@ -2673,8 +2659,16 @@
    2673 2659
         FT_TRACE5(( "\n" ));
    
    2674 2660
     
    
    2675 2661
         if ( !face->is_cff2 && !blend->glyphoffsets )
    
    2676
    -      if ( FT_SET_ERROR( ft_var_load_gvar( face ) ) )
    
    2662
    +    {
    
    2663
    +      /* While a missing 'gvar' table is acceptable, for example for */
    
    2664
    +      /* fonts that only vary metrics information or 'COLR' v1       */
    
    2665
    +      /* `PaintVar*` tables, an incorrect SFNT table offset or size  */
    
    2666
    +      /* for 'gvar', or an inconsistent 'gvar' table is not.         */
    
    2667
    +      error = ft_var_load_gvar( face );
    
    2668
    +      if ( error != FT_Err_Table_Missing && error != FT_Err_Ok )
    
    2677 2669
             goto Exit;
    
    2670
    +      error = FT_Err_Ok;
    
    2671
    +    }
    
    2678 2672
     
    
    2679 2673
         if ( !blend->coords )
    
    2680 2674
         {
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]