freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] Proposal: Feature control for variable


From: @drott
Subject: [Git][freetype/freetype][master] Proposal: Feature control for variable COLRv1
Date: Tue, 21 Jun 2022 09:27:28 +0000

Dominik Röttsches pushed to branch master at FreeType / FreeType

Commits:

  • 4b6f92e6
    by Dominik Röttsches at 2022-06-21T12:25:46+03:00
    Proposal: Feature control for variable COLRv1
    
    * include/freetype/ftdriver.h (variable-color-v1 property): Add documentation
    for variable-colr-v1 property.
    * src/truetype/ttdriver.c (tt_property_set): Ingest variable-control property
    when called, set to enable_variable_colrv1 driver flag.
    * src/truetype/ttobjs.h (TT_DriverRec): Add enable_variable_colrv1 flag.
    

3 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'; a single property
    
    218
    -   *   @interpreter-version is available, as documented in the @properties
    
    219
    -   *   section.
    
    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.
    
    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,6 +820,48 @@ 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
    +   */
    
    823 865
     
    
    824 866
       /**************************************************************************
    
    825 867
        *
    

  • src/truetype/ttdriver.c
    ... ... @@ -108,6 +108,23 @@
    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
    +
    
    111 128
         FT_TRACE2(( "tt_property_set: missing property `%s'\n",
    
    112 129
                     property_name ));
    
    113 130
         return FT_THROW( Missing_Property );
    

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


  • reply via email to

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