freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][gsoc-anurag-2022-docs] 3 commits: [sfnt] Handle


From: Anurag Thakur (@AdbhutDev)
Subject: [Git][freetype/freetype][gsoc-anurag-2022-docs] 3 commits: [sfnt] Handle variable `COLR` v1 fonts without delta set index map
Date: Sun, 11 Sep 2022 06:28:48 +0000

Anurag Thakur pushed to branch gsoc-anurag-2022-docs at FreeType / FreeType

Commits:

  • 91a7fae7
    by Dominik Röttsches at 2022-09-05T15:52:58+02:00
    [sfnt] Handle variable `COLR` v1 fonts without delta set index map
    
    Fixes #1178.
    
    * src/sfnt/ttcolr.c (get_deltas_for_var_index_base): Set outer index to
    0 and inner index to the delta index when retrieving deltas if the
    `COLR` table has no delta set index map.
    
  • 8e68439a
    by Dominik Röttsches at 2022-09-06T17:18:17+02:00
    [truetype] Reject 'fvar' loading when `num_instances` is too small.
    
    * src/truetype/ttgxvar.c (TT_Get_MM_Var): Reject retrieving master when
    'fvar' values locally do not match with sanitized values from initialization
    at `sfnt_init_face` time.
    
    Reported as
    
      https://bugs.chromium.org/p/chromium/issues/detail?id=1360295
    
  • ea114d2c
    by Anurag Thakur at 2022-09-11T11:58:22+05:30
    Begin adding comments for documentation
    

3 changed files:

Changes:

  • src/sfnt/ttcolr.c
    ... ... @@ -604,9 +604,8 @@
    604 604
           }
    
    605 605
           else
    
    606 606
           {
    
    607
    -        /* TODO: Direct lookup case not implemented or tested yet. */
    
    608
    -        FT_ASSERT( 0 );
    
    609
    -        return 0;
    
    607
    +        outer_index = 0;
    
    608
    +        inner_index = loop_var_index;
    
    610 609
           }
    
    611 610
     
    
    612 611
           deltas[i] = mm->get_item_delta( FT_FACE( face ), &colr->var_store,
    

  • src/smooth/ftsmooth.c
    ... ... @@ -477,6 +477,7 @@
    477 477
     
    
    478 478
         slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
    
    479 479
     
    
    480
    +    /* Outline points are expressed as 1/64th of a pixel (26.6 fixed-point format) */
    
    480 481
         x_shift = 64 * -slot->bitmap_left;
    
    481 482
         y_shift = 64 * -slot->bitmap_top;
    
    482 483
         if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
    

  • src/truetype/ttgxvar.c
    ... ... @@ -2207,6 +2207,11 @@
    2207 2207
           FT_FRAME_END
    
    2208 2208
         };
    
    2209 2209
     
    
    2210
    +    /* `num_instances' holds the number of all named instances including  */
    
    2211
    +    /* the default instance, which might be missing in the table of named */
    
    2212
    +    /* instances (in 'fvar').  This value is validated in `sfobjs.c` and  */
    
    2213
    +    /* may be reset to 0 if consistency checks fail.                      */
    
    2214
    +    num_instances = (FT_UInt)face->root.style_flags >> 16;
    
    2210 2215
     
    
    2211 2216
         /* read the font data and set up the internal representation */
    
    2212 2217
         /* if not already done                                       */
    
    ... ... @@ -2231,6 +2236,17 @@
    2231 2236
           if ( FT_STREAM_READ_FIELDS( fvar_fields, &fvar_head ) )
    
    2232 2237
             goto Exit;
    
    2233 2238
     
    
    2239
    +      /* If `num_instances` is larger, synthetization of the default  */
    
    2240
    +      /* instance is required.  If `num_instances` is smaller,        */
    
    2241
    +      /* however, the value has been reset to 0 in `sfnt_init_face`   */
    
    2242
    +      /* (in `sfobjs.c`); in this case we have underallocated `mmvar` */
    
    2243
    +      /* structs.                                                     */
    
    2244
    +      if ( num_instances < fvar_head.instanceCount )
    
    2245
    +      {
    
    2246
    +        error = FT_THROW( Invalid_Table );
    
    2247
    +        goto Exit;
    
    2248
    +      }
    
    2249
    +
    
    2234 2250
           usePsName = FT_BOOL( fvar_head.instanceSize ==
    
    2235 2251
                                6 + 4 * fvar_head.axisCount );
    
    2236 2252
     
    
    ... ... @@ -2249,11 +2265,6 @@
    2249 2265
         else
    
    2250 2266
           num_axes = face->blend->num_axis;
    
    2251 2267
     
    
    2252
    -    /* `num_instances' holds the number of all named instances, */
    
    2253
    -    /* including the default instance which might be missing    */
    
    2254
    -    /* in fvar's table of named instances                       */
    
    2255
    -    num_instances = (FT_UInt)face->root.style_flags >> 16;
    
    2256
    -
    
    2257 2268
         /* prepare storage area for MM data; this cannot overflow   */
    
    2258 2269
         /* 32-bit arithmetic because of the size limits used in the */
    
    2259 2270
         /* `fvar' table validity check in `sfnt_init_face'          */
    


  • reply via email to

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