freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [truetype] tt_size_reset_height to take


From: Ben Wagner (@bungeman)
Subject: [Git][freetype/freetype][master] [truetype] tt_size_reset_height to take FT_Size
Date: Mon, 17 Apr 2023 16:50:22 +0000

Ben Wagner pushed to branch master at FreeType / FreeType

Commits:

  • c4fe77c3
    by Ben Wagner at 2023-04-17T12:32:04-04:00
    [truetype] tt_size_reset_height to take FT_Size
    
    The `MetricsVariations` `FT_Size_Reset_Func` is defined to take an
    `FT_Size`. Because `tt_size_reset_height` is to be used as such a
    function, it must also take an `FT_Size` instead of a `TT_Size`. Even
    though the pointers passed will be the same at runtime, calling a
    function through a pointer of a different type from the original
    function pointer type is undefined behavior. This may be caught at
    runtime by Control Flow Integrity with something like clang's
    `cfi-icall`.
    
    Issue: https://crbug.com/1433651
    
    * src/truetype/ttobjs.h (tt_size_reset_height): take `FT_Size`
    
    * src/truetype/ttobjs.c (tt_size_reset_height): take `FT_Size` and
    update documentation
    

2 changed files:

Changes:

  • src/truetype/ttobjs.c
    ... ... @@ -1346,12 +1346,16 @@
    1346 1346
        *   Used for variation fonts as an iterator function.
    
    1347 1347
        *
    
    1348 1348
        * @Input:
    
    1349
    -   *   size ::
    
    1350
    -   *     A handle to the target size object.
    
    1349
    +   *   ft_size ::
    
    1350
    +   *     A handle to the target TT_Size object. This function will be called
    
    1351
    +   *     through a `FT_Size_Reset_Func` pointer which takes `FT_Size`. This
    
    1352
    +   *     function must take `FT_Size` as a result. The passed `FT_Size` is
    
    1353
    +   *     expected to point to a `TT_Size`.
    
    1351 1354
        */
    
    1352 1355
       FT_LOCAL_DEF( FT_Error )
    
    1353
    -  tt_size_reset_height( TT_Size  size )
    
    1356
    +  tt_size_reset_height( FT_Size  ft_size )
    
    1354 1357
       {
    
    1358
    +    TT_Size           size         = (TT_Size)ft_size;
    
    1355 1359
         TT_Face           face         = (TT_Face)size->root.face;
    
    1356 1360
         FT_Size_Metrics*  size_metrics = &size->hinted_metrics;
    
    1357 1361
     
    
    ... ... @@ -1408,7 +1412,7 @@
    1408 1412
         FT_Size_Metrics*  size_metrics = &size->hinted_metrics;
    
    1409 1413
     
    
    1410 1414
     
    
    1411
    -    error = tt_size_reset_height( size );
    
    1415
    +    error = tt_size_reset_height( (FT_Size)size );
    
    1412 1416
         if ( error )
    
    1413 1417
           return error;
    
    1414 1418
     
    

  • src/truetype/ttobjs.h
    ... ... @@ -391,7 +391,7 @@ FT_BEGIN_HEADER
    391 391
     #endif /* TT_USE_BYTECODE_INTERPRETER */
    
    392 392
     
    
    393 393
       FT_LOCAL( FT_Error )
    
    394
    -  tt_size_reset_height( TT_Size  size );
    
    394
    +  tt_size_reset_height( FT_Size  size );
    
    395 395
     
    
    396 396
       FT_LOCAL( FT_Error )
    
    397 397
       tt_size_reset( TT_Size  size );
    


  • reply via email to

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