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] Remove temporary runt


From: Werner Lemberg (@wl)
Subject: [Git][freetype/freetype][master] 2 commits: [sfnt] Remove temporary runtime flag for variable 'COLR' v1.
Date: Mon, 16 Jan 2023 15:42:52 +0000

Werner Lemberg pushed to branch master at FreeType / FreeType

Commits:

  • 2692b321
    by Dominik Röttsches at 2023-01-16T14:02:36+01:00
    [sfnt] Remove temporary runtime flag for variable 'COLR' v1.
    
    Fixes #1187.
    
    * src/sfnt/ttcolr.c (top level, read_paint, tt_face_load_colr,
    tt_face_free_colr, get_deltas_for_var_index_base,
    tt_face_get_color_glyph_clipbox, tt_face_get_colorline_stops): Remove macro
    definition `VARIABLE_COLRV1_ENABLED` and its usage.
    
    * src/truetype/ttdriver.c (tt_property_set): Remove parsing of
    'TEMPORARY-enable-variable-colrv1' property name.
    
    * src/truetype/ttobjs.h (TT_DriverRec): Remove `enable_variable_colrv1`
    flag.
    
  • 6a179ff7
    by Werner Lemberg at 2023-01-16T16:38:56+01:00
    sr/*.c: Various minor fixes.
    
    * src/autofit/ft-hb.c (_hb_ft_reference_table): Call `FT_UNUSED` after
    variable declarations.
    
    * src/gxvalid/gxvjust.c (gxv_just_widthDeltaClusters_validate): Eliminate
    unused variable.
    
    * src/gzip/ftgzip.c: Don't call GCC '-Wstrict-prototypes' pragma for C++
    compiler.
    
    * src/sfnt/ttcolr.c (ENSURE_READ_BYTES): Remove final semicolon to avoid
    compiler warning.
    
    * src/sfnt/ttsvg.c (tt_face_load_svg_doc): Fix signedness warning.
    

8 changed files:

Changes:

  • include/freetype/ftdriver.h
    ... ... @@ -214,9 +214,9 @@ FT_BEGIN_HEADER
    214 214
        *   itself, it is possible to control its behaviour with @FT_Property_Set
    
    215 215
        *   and @FT_Property_Get.
    
    216 216
        *
    
    217
    -   *   The TrueType driver's module name is 'truetype'; two properties are
    
    218
    -   *   available, @interpreter-version and @TEMPORARY-enable-variable-colrv1, as
    
    219
    -   *   documented in the @properties section.
    
    217
    +   *   The TrueType driver's module name is 'truetype'; a single property
    
    218
    +   *   @interpreter-version is available, as documented in the @properties
    
    219
    +   *   section.
    
    220 220
        *
    
    221 221
        *   To help understand the differences between interpreter versions, we
    
    222 222
        *   introduce a list of definitions, kindly provided by Greg Hitchcock.
    
    ... ... @@ -820,49 +820,6 @@ FT_BEGIN_HEADER
    820 820
        *   2.5
    
    821 821
        */
    
    822 822
     
    
    823
    -  /**************************************************************************
    
    824
    -   *
    
    825
    -   * @property:
    
    826
    -   *   TEMPORARY-enable-variable-colrv1
    
    827
    -   *
    
    828
    -   * @description:
    
    829
    -   *   Controls experimental support of variable COLRv1 and whether the COLRv1
    
    830
    -   *   implementation should take into account variation deltas. This tells the
    
    831
    -   *   COLRv1 API methods whether they should read from the font and apply
    
    832
    -   *   variable deltas to COLRv1 properties. The feature is default off.  When
    
    833
    -   *   on, variable COLRv1 deltas are applied for COLRv1 features for which they
    
    834
    -   *   are already implemented. When off, variable deltas are ignored even if
    
    835
    -   *   the respective PaintVar* table may already be understood.
    
    836
    -   *
    
    837
    -   *   WARNING: Temporary flag during development of variable COLRv1. This flag
    
    838
    -   *   will be removed, do not rely on it. Full variable COLRv1 support will be
    
    839
    -   *   announced separately.
    
    840
    -   *
    
    841
    -   * @note:
    
    842
    -   *   This property cannot be set via the `FREETYPE_PROPERTIES` environment
    
    843
    -   *   variable.
    
    844
    -   *
    
    845
    -   * @example:
    
    846
    -   *   The following example code demonstrates how to enable variable
    
    847
    -   *   COLRv1.
    
    848
    -   *
    
    849
    -   *   ```
    
    850
    -   *     FT_Library  library;
    
    851
    -   *     FT_Face     face;
    
    852
    -   *     FT_Bool     variable_colrv1 = TRUE;
    
    853
    -   *
    
    854
    -   *
    
    855
    -   *     FT_Init_FreeType( &library );
    
    856
    -   *
    
    857
    -   *     FT_Property_Set( library, "truetype",
    
    858
    -   *                               "TEMPORARY-enable-variable-colrv1",
    
    859
    -   *                               &variable_colr_v1 );
    
    860
    -   *   ```
    
    861
    -   *
    
    862
    -   * @since:
    
    863
    -   *   2.12.2
    
    864
    -   */
    
    865
    -
    
    866 823
       /**************************************************************************
    
    867 824
        *
    
    868 825
        * @property:
    

  • src/autofit/ft-hb.c
    ... ... @@ -38,12 +38,13 @@
    38 38
     static hb_blob_t *
    
    39 39
     _hb_ft_reference_table (hb_face_t *face, hb_tag_t tag, void *user_data)
    
    40 40
     {
    
    41
    -  FT_UNUSED (face);
    
    42 41
       FT_Face ft_face = (FT_Face) user_data;
    
    43 42
       FT_Byte *buffer;
    
    44 43
       FT_ULong  length = 0;
    
    45 44
       FT_Error error;
    
    46 45
     
    
    46
    +  FT_UNUSED (face);
    
    47
    +
    
    47 48
       /* Note: FreeType like HarfBuzz uses the NONE tag for fetching the entire blob */
    
    48 49
     
    
    49 50
       error = FT_Load_Sfnt_Table (ft_face, tag, 0, NULL, &length);
    

  • src/gxvalid/gxvjust.c
    ... ... @@ -156,7 +156,6 @@
    156 156
       {
    
    157 157
         FT_Bytes  p         = table;
    
    158 158
         FT_Bytes  wdc_end   = table + GXV_JUST_DATA( wdc_offset_max );
    
    159
    -    FT_UInt   i;
    
    160 159
     
    
    161 160
     
    
    162 161
         GXV_NAME_ENTER( "just justDeltaClusters" );
    
    ... ... @@ -164,7 +163,7 @@
    164 163
         if ( limit <= wdc_end )
    
    165 164
           FT_INVALID_OFFSET;
    
    166 165
     
    
    167
    -    for ( i = 0; p <= wdc_end; i++ )
    
    166
    +    while ( p <= wdc_end )
    
    168 167
         {
    
    169 168
           gxv_just_wdc_entry_validate( p, limit, gxvalid );
    
    170 169
           p += gxvalid->subtable_length;
    

  • src/gzip/ftgzip.c
    ... ... @@ -90,7 +90,9 @@
    90 90
     
    
    91 91
     #if defined( __GNUC__ )
    
    92 92
     #pragma GCC diagnostic push
    
    93
    +#ifndef __cplusplus
    
    93 94
     #pragma GCC diagnostic ignored "-Wstrict-prototypes"
    
    95
    +#endif
    
    94 96
     #pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
    
    95 97
     #pragma GCC diagnostic ignored "-Wredundant-decls"
    
    96 98
     #endif
    

  • src/sfnt/ttcolr.c
    ... ... @@ -38,13 +38,6 @@
    38 38
     #include <freetype/internal/services/svmm.h>
    
    39 39
     #endif
    
    40 40
     
    
    41
    - /* the next two code lines are a temporary hack, to be removed together */
    
    42
    - /* with `VARIABLE_COLRV1_ENABLED` and related code as soon as variable  */
    
    43
    - /* 'COLR' support is complete and tested                                */
    
    44
    -#include "../truetype/ttobjs.h"
    
    45
    -#include "../truetype/ttdriver.h"
    
    46
    -
    
    47
    -
    
    48 41
     #ifdef TT_CONFIG_OPTION_COLOR_LAYERS
    
    49 42
     
    
    50 43
     #include "ttcolr.h"
    
    ... ... @@ -65,15 +58,10 @@
    65 58
     #define COLRV1_HEADER_SIZE               34U
    
    66 59
     
    
    67 60
     
    
    68
    -#define VARIABLE_COLRV1_ENABLED                                            \
    
    69
    -          ( ((TT_Driver)FT_FACE_DRIVER( face ))->root.clazz ==             \
    
    70
    -              &tt_driver_class                                          && \
    
    71
    -            ((TT_Driver)FT_FACE_DRIVER( face ))->enable_variable_colrv1 )
    
    72
    -
    
    73 61
     #define ENSURE_READ_BYTES( byte_size )                             \
    
    74 62
       if ( p < colr->paints_start_v1                                || \
    
    75 63
            p > (FT_Byte*)colr->table + colr->table_size - byte_size )  \
    
    76
    -    return 0;
    
    64
    +    return 0
    
    77 65
     
    
    78 66
     
    
    79 67
       typedef enum  FT_PaintFormat_Internal_
    
    ... ... @@ -309,8 +297,7 @@
    309 297
           colr->delta_set_idx_map.outerIndex = NULL;
    
    310 298
           colr->delta_set_idx_map.innerIndex = NULL;
    
    311 299
     
    
    312
    -      if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR &&
    
    313
    -           VARIABLE_COLRV1_ENABLED                         )
    
    300
    +      if ( face->variation_support & TT_FACE_FLAG_VAR_FVAR )
    
    314 301
           {
    
    315 302
             FT_ULong  var_idx_map_offset, var_store_offset;
    
    316 303
     
    
    ... ... @@ -370,7 +357,6 @@
    370 357
     
    
    371 358
       InvalidTable:
    
    372 359
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    373
    -    if ( VARIABLE_COLRV1_ENABLED )
    
    374 360
         {
    
    375 361
           FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
    
    376 362
     
    
    ... ... @@ -404,7 +390,6 @@
    404 390
         if ( colr )
    
    405 391
         {
    
    406 392
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    407
    -      if ( VARIABLE_COLRV1_ENABLED )
    
    408 393
           {
    
    409 394
             FT_Service_MultiMasters  mm = (FT_Service_MultiMasters)face->mm;
    
    410 395
     
    
    ... ... @@ -600,12 +585,6 @@
    600 585
         FT_UInt  i = 0;
    
    601 586
     
    
    602 587
     
    
    603
    -    if ( !VARIABLE_COLRV1_ENABLED )
    
    604
    -    {
    
    605
    -      FT_ASSERT( 0 );
    
    606
    -      return 0;
    
    607
    -    }
    
    608
    -
    
    609 588
         if ( var_index_base == 0xFFFFFFFF )
    
    610 589
         {
    
    611 590
           for ( i = 0; i < num_deltas; ++i )
    
    ... ... @@ -710,8 +689,7 @@
    710 689
     
    
    711 690
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    712 691
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    713
    -               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID &&
    
    714
    -           VARIABLE_COLRV1_ENABLED                    )
    
    692
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SOLID )
    
    715 693
           {
    
    716 694
             ENSURE_READ_BYTES( 4 );
    
    717 695
             var_index_base = FT_NEXT_ULONG( p );
    
    ... ... @@ -772,7 +750,7 @@
    772 750
           apaint->u.linear_gradient.p2.y = INT_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    773 751
     
    
    774 752
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    775
    -      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    753
    +      if ( do_read_var )
    
    776 754
           {
    
    777 755
             ENSURE_READ_BYTES( 4 );
    
    778 756
             var_index_base = FT_NEXT_ULONG ( p );
    
    ... ... @@ -830,7 +808,7 @@
    830 808
           apaint->u.radial_gradient.r1 = tmp < 0 ? FT_INT_MAX : tmp;
    
    831 809
     
    
    832 810
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    833
    -      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    811
    +      if ( do_read_var )
    
    834 812
           {
    
    835 813
             ENSURE_READ_BYTES( 4 );
    
    836 814
             var_index_base = FT_NEXT_ULONG ( p );
    
    ... ... @@ -881,7 +859,7 @@
    881 859
               F2DOT14_TO_FIXED( FT_NEXT_SHORT( p ) );
    
    882 860
     
    
    883 861
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    884
    -      if ( do_read_var && VARIABLE_COLRV1_ENABLED )
    
    862
    +      if ( do_read_var )
    
    885 863
           {
    
    886 864
             ENSURE_READ_BYTES( 4 );
    
    887 865
             var_index_base = FT_NEXT_ULONG ( p );
    
    ... ... @@ -941,8 +919,7 @@
    941 919
     
    
    942 920
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    943 921
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    944
    -             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM &&
    
    945
    -           VARIABLE_COLRV1_ENABLED                      )
    
    922
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSFORM )
    
    946 923
           {
    
    947 924
             ENSURE_READ_BYTES( 4 );
    
    948 925
             var_index_base = FT_NEXT_ULONG( p );
    
    ... ... @@ -978,8 +955,7 @@
    978 955
     
    
    979 956
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    980 957
           if ( (FT_PaintFormat_Internal)apaint->format ==
    
    981
    -             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE &&
    
    982
    -           VARIABLE_COLRV1_ENABLED                      )
    
    958
    +             FT_COLR_PAINTFORMAT_INTERNAL_VAR_TRANSLATE )
    
    983 959
           {
    
    984 960
             ENSURE_READ_BYTES( 4 );
    
    985 961
             var_index_base = FT_NEXT_ULONG( p );
    
    ... ... @@ -1055,8 +1031,7 @@
    1055 1031
                  (FT_PaintFormat_Internal)apaint->format ==
    
    1056 1032
                    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM        ||
    
    1057 1033
                  (FT_PaintFormat_Internal)apaint->format ==
    
    1058
    -               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) &&
    
    1059
    -           VARIABLE_COLRV1_ENABLED                                     )
    
    1034
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SCALE_UNIFORM_CENTER ) )
    
    1060 1035
           {
    
    1061 1036
             ENSURE_READ_BYTES( 4 );
    
    1062 1037
             var_index_base = FT_NEXT_ULONG( p );
    
    ... ... @@ -1151,8 +1126,7 @@
    1151 1126
           if ( ( (FT_PaintFormat_Internal)apaint->format ==
    
    1152 1127
                    FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE        ||
    
    1153 1128
                  (FT_PaintFormat_Internal)apaint->format ==
    
    1154
    -               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) &&
    
    1155
    -           VARIABLE_COLRV1_ENABLED                              )
    
    1129
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_ROTATE_CENTER ) )
    
    1156 1130
           {
    
    1157 1131
             FT_UInt  num_deltas = 0;
    
    1158 1132
     
    
    ... ... @@ -1225,8 +1199,7 @@
    1225 1199
           if ( ( (FT_PaintFormat_Internal)apaint->format ==
    
    1226 1200
                    FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW        ||
    
    1227 1201
                  (FT_PaintFormat_Internal)apaint->format ==
    
    1228
    -               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) &&
    
    1229
    -           VARIABLE_COLRV1_ENABLED                            )
    
    1202
    +               FT_COLR_PAINTFORMAT_INTERNAL_VAR_SKEW_CENTER ) )
    
    1230 1203
           {
    
    1231 1204
             ENSURE_READ_BYTES( 4 );
    
    1232 1205
             var_index_base = FT_NEXT_ULONG( p );
    
    ... ... @@ -1471,7 +1444,7 @@
    1471 1444
                                             face->root.size->metrics.y_scale );
    
    1472 1445
     
    
    1473 1446
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1474
    -        if ( VARIABLE_COLRV1_ENABLED && format == 2 )
    
    1447
    +        if ( format == 2 )
    
    1475 1448
             {
    
    1476 1449
               FT_ULong         var_index_base = 0;
    
    1477 1450
               /* varIndexBase offset for clipbox is 3 at most. */
    
    ... ... @@ -1661,7 +1634,6 @@
    1661 1634
           var_index_base = FT_NEXT_ULONG( p );
    
    1662 1635
     
    
    1663 1636
     #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
    
    1664
    -      if ( VARIABLE_COLRV1_ENABLED )
    
    1665 1637
           {
    
    1666 1638
             FT_Int  item_deltas[2];
    
    1667 1639
     
    

  • src/sfnt/ttsvg.c
    ... ... @@ -310,7 +310,8 @@
    310 310
         if ( error != FT_Err_Ok )
    
    311 311
           goto Exit;
    
    312 312
     
    
    313
    -    doc_limit = svg->table_size - ( doc_list - (FT_Byte*)svg->table );
    
    313
    +    doc_limit = svg->table_size -
    
    314
    +                  (FT_ULong)( doc_list - (FT_Byte*)svg->table );
    
    314 315
         if ( doc_offset > doc_limit              ||
    
    315 316
              doc_length > doc_limit - doc_offset )
    
    316 317
         {
    

  • src/truetype/ttdriver.c
    ... ... @@ -108,23 +108,6 @@
    108 108
           return error;
    
    109 109
         }
    
    110 110
     
    
    111
    -    if ( !ft_strcmp( property_name, "TEMPORARY-enable-variable-colrv1" ) )
    
    112
    -    {
    
    113
    -      /* This flag is temporary and can't be set with environment variables. */
    
    114
    -      if ( !value_is_string )
    
    115
    -      {
    
    116
    -        FT_Bool*  bv = (FT_Bool*)value;
    
    117
    -
    
    118
    -        if ( *bv == TRUE || *bv == FALSE)
    
    119
    -          driver->enable_variable_colrv1 = *bv;
    
    120
    -        else
    
    121
    -          error = FT_ERR( Unimplemented_Feature );
    
    122
    -      } else
    
    123
    -        error = FT_ERR( Invalid_Argument );
    
    124
    -
    
    125
    -      return error;
    
    126
    -    }
    
    127
    -
    
    128 111
         FT_TRACE2(( "tt_property_set: missing property `%s'\n",
    
    129 112
                     property_name ));
    
    130 113
         return FT_THROW( Missing_Property );
    

  • src/truetype/ttobjs.h
    ... ... @@ -337,8 +337,6 @@ FT_BEGIN_HEADER
    337 337
     
    
    338 338
         FT_UInt  interpreter_version;
    
    339 339
     
    
    340
    -    FT_Bool  enable_variable_colrv1;
    
    341
    -
    
    342 340
       } TT_DriverRec;
    
    343 341
     
    
    344 342
     
    


  • reply via email to

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