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] Fix typo in clip box


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] 2 commits: [sfnt] Fix typo in clip box computation.
Date: Sat, 30 Jul 2022 13:26:37 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • 649352ab
    by Dominik Röttsches at 2022-07-30T15:10:17+02:00
    [sfnt] Fix typo in clip box computation.
    
    * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Use appropriate
    scale factor for `yMin` and `yMax`.
    
  • 919561ca
    by Dominik Röttsches at 2022-07-30T15:24:58+02:00
    [sfnt] Implement VarClipBox.
    
    * src/sfnt/ttcolr.c (tt_face_get_color_glyph_clipbox): Depending on the
    format, read `var_index_base`, then retrieve and apply scaled deltas.
    

1 changed file:

Changes:

  • src/sfnt/ttcolr.c
    ... ... @@ -1362,7 +1362,7 @@
    1362 1362
         clip_list_format = FT_NEXT_BYTE ( p );
    
    1363 1363
     
    
    1364 1364
         /* Format byte used here to be able to upgrade ClipList for >16bit */
    
    1365
    -    /* glyph ids; for now we can expect it to be 0.                    */
    
    1365
    +    /* glyph ids; for now we can expect it to be 1.                    */
    
    1366 1366
         if ( !( clip_list_format == 1 ) )
    
    1367 1367
           return 0;
    
    1368 1368
     
    
    ... ... @@ -1390,7 +1390,7 @@
    1390 1390
     
    
    1391 1391
             format = FT_NEXT_BYTE( p1 );
    
    1392 1392
     
    
    1393
    -        if ( format > 1 )
    
    1393
    +        if ( format > 2 )
    
    1394 1394
               return 0;
    
    1395 1395
     
    
    1396 1396
             /* Check whether we can extract four `FWORD`. */
    
    ... ... @@ -1404,11 +1404,40 @@
    1404 1404
             font_clip_box.xMin = FT_MulFix( FT_NEXT_SHORT( p1 ),
    
    1405 1405
                                             face->root.size->metrics.x_scale );
    
    1406 1406
             font_clip_box.yMin = FT_MulFix( FT_NEXT_SHORT( p1 ),
    
    1407
    -                                        face->root.size->metrics.x_scale );
    
    1407
    +                                        face->root.size->metrics.y_scale );
    
    1408 1408
             font_clip_box.xMax = FT_MulFix( FT_NEXT_SHORT( p1 ),
    
    1409 1409
                                             face->root.size->metrics.x_scale );
    
    1410 1410
             font_clip_box.yMax = FT_MulFix( FT_NEXT_SHORT( p1 ),
    
    1411
    -                                        face->root.size->metrics.x_scale );
    
    1411
    +                                        face->root.size->metrics.y_scale );
    
    1412
    +
    
    1413
    +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1414
    +        if ( VARIABLE_COLRV1_ENABLED && format == 2 )
    
    1415
    +        {
    
    1416
    +          FT_ULong         var_index_base = 0;
    
    1417
    +          /* varIndexBase offset for clipbox is 3 at most. */
    
    1418
    +          FT_ItemVarDelta  item_deltas[4] = { 0, 0, 0, 0 };
    
    1419
    +
    
    1420
    +
    
    1421
    +          /* Check whether we can extract a 32-bit VarIdxBase now. */
    
    1422
    +          if ( p1 > limit - 4 )
    
    1423
    +            return 0;
    
    1424
    +
    
    1425
    +          var_index_base = FT_NEXT_ULONG( p1 );
    
    1426
    +
    
    1427
    +          if ( !get_deltas_for_var_index_base( face, colr, var_index_base, 4,
    
    1428
    +                                               item_deltas ) )
    
    1429
    +            return 0;
    
    1430
    +
    
    1431
    +          font_clip_box.xMin +=
    
    1432
    +              FT_MulFix( item_deltas[0], face->root.size->metrics.x_scale );
    
    1433
    +          font_clip_box.yMin +=
    
    1434
    +              FT_MulFix( item_deltas[1], face->root.size->metrics.y_scale );
    
    1435
    +          font_clip_box.xMax +=
    
    1436
    +              FT_MulFix( item_deltas[2], face->root.size->metrics.x_scale );
    
    1437
    +          font_clip_box.yMax +=
    
    1438
    +              FT_MulFix( item_deltas[3], face->root.size->metrics.y_scale );
    
    1439
    +        }
    
    1440
    +#endif
    
    1412 1441
     
    
    1413 1442
             /* Make 4 corner points (xMin, yMin), (xMax, yMax) and transform */
    
    1414 1443
             /* them.  If we we would only transform two corner points and    */
    


  • reply via email to

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