freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 2 commits: [truetype] Handle 0xFFFF spe


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: [truetype] Handle 0xFFFF special value inside delta retrieval function
Date: Tue, 24 May 2022 21:50:47 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • include/freetype/internal/ftmmtypes.h
    ... ... @@ -24,14 +24,16 @@
    24 24
     FT_BEGIN_HEADER
    
    25 25
     
    
    26 26
     
    
    27
    +  typedef FT_Long FT_ItemVarDelta;
    
    28
    +
    
    27 29
       typedef struct  GX_ItemVarDataRec_
    
    28 30
       {
    
    29
    -    FT_UInt    itemCount;      /* number of delta sets per item         */
    
    30
    -    FT_UInt    regionIdxCount; /* number of region indices in this data */
    
    31
    -    FT_UInt*   regionIndices;  /* array of `regionCount' indices;       */
    
    32
    -                               /* these index `varRegionList'           */
    
    33
    -    FT_Short*  deltaSet;       /* array of `itemCount' deltas           */
    
    34
    -                               /* use `innerIndex' for this array       */
    
    31
    +    FT_UInt            itemCount;       /* number of delta sets per item    */
    
    32
    +    FT_UInt            regionIdxCount;  /* number of region indices         */
    
    33
    +    FT_UInt*           regionIndices;   /* array of `regionCount' indices;  */
    
    34
    +                                        /* these index `varRegionList'      */
    
    35
    +    FT_ItemVarDelta*   deltaSet;        /* array of `itemCount' deltas      */
    
    36
    +                                        /* use `innerIndex' for this array  */
    
    35 37
     
    
    36 38
       } GX_ItemVarDataRec, *GX_ItemVarData;
    
    37 39
     
    

  • src/truetype/ttgxvar.c
    ... ... @@ -631,44 +631,25 @@
    631 631
                              varData->regionIdxCount * varData->itemCount ) )
    
    632 632
             goto Exit;
    
    633 633
     
    
    634
    -      /* the delta set is stored as a 2-dimensional array of shorts */
    
    635
    -      if ( long_words )
    
    634
    +      for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
    
    636 635
           {
    
    637
    -        /* new in OpenType 1.9, currently for 'COLR' table only;          */
    
    638
    -        /* the deltas are interpreted as 16.16 fixed-point scaling values */
    
    639
    -
    
    640
    -        /* not supported yet */
    
    641
    -
    
    642
    -        error = FT_THROW( Invalid_Table );
    
    643
    -        goto Exit;
    
    644
    -      }
    
    645
    -      else
    
    646
    -      {
    
    647
    -        for ( j = 0; j < varData->itemCount * varData->regionIdxCount; )
    
    636
    +        if ( long_words )
    
    648 637
             {
    
    649 638
               for ( k = 0; k < wordDeltaCount; k++, j++ )
    
    650
    -          {
    
    651
    -            /* read the short deltas */
    
    652
    -            FT_Short  delta;
    
    653
    -
    
    654
    -
    
    655
    -            if ( FT_READ_SHORT( delta ) )
    
    639
    +            if ( FT_READ_LONG( varData->deltaSet[j] ) )
    
    656 640
                   goto Exit;
    
    657
    -
    
    658
    -            varData->deltaSet[j] = delta;
    
    659
    -          }
    
    660
    -
    
    661 641
               for ( ; k < varData->regionIdxCount; k++, j++ )
    
    662
    -          {
    
    663
    -            /* read the (signed) byte deltas */
    
    664
    -            FT_Char  delta;
    
    665
    -
    
    666
    -
    
    667
    -            if ( FT_READ_CHAR( delta ) )
    
    642
    +            if ( FT_READ_SHORT( varData->deltaSet[j] ) )
    
    643
    +              goto Exit;
    
    644
    +        }
    
    645
    +        else
    
    646
    +        {
    
    647
    +          for ( k = 0; k < wordDeltaCount; k++, j++ )
    
    648
    +            if ( FT_READ_SHORT( varData->deltaSet[j] ) )
    
    649
    +              goto Exit;
    
    650
    +          for ( ; k < varData->regionIdxCount; k++, j++ )
    
    651
    +            if ( FT_READ_CHAR( varData->deltaSet[j] ) )
    
    668 652
                   goto Exit;
    
    669
    -
    
    670
    -            varData->deltaSet[j] = delta;
    
    671
    -          }
    
    672 653
             }
    
    673 654
           }
    
    674 655
         }
    
    ... ... @@ -964,14 +945,18 @@
    964 945
                              FT_UInt          outerIndex,
    
    965 946
                              FT_UInt          innerIndex )
    
    966 947
       {
    
    967
    -    GX_ItemVarData  varData;
    
    968
    -    FT_Short*       deltaSet;
    
    948
    +    GX_ItemVarData    varData;
    
    949
    +    FT_ItemVarDelta*  deltaSet;
    
    969 950
     
    
    970 951
         FT_UInt   master, j;
    
    971 952
         FT_Fixed  netAdjustment = 0;     /* accumulated adjustment */
    
    972 953
         FT_Fixed  scaledDelta;
    
    973 954
         FT_Fixed  delta;
    
    974 955
     
    
    956
    +    /* OpenType 1.8.4+: No variation data for this item
    
    957
    +     *  as indices have special value 0xFFFF. */
    
    958
    +    if (outerIndex == 0xFFFF && innerIndex == 0xFFFF)
    
    959
    +      return 0;
    
    975 960
     
    
    976 961
         /* See pseudo code from `Font Variations Overview' */
    
    977 962
         /* in the OpenType specification.                  */
    
    ... ... @@ -1148,20 +1133,12 @@
    1148 1133
           }
    
    1149 1134
         }
    
    1150 1135
     
    
    1151
    -    /* new test introduced in OpenType 1.8.4 */
    
    1152
    -    if ( outerIndex == 0xFFFFU && innerIndex == 0xFFFFU )
    
    1153
    -    {
    
    1154
    -      FT_TRACE5(( "no adjustment to %s value %d\n",
    
    1155
    -                  vertical ? "vertical height" : "horizontal width",
    
    1156
    -                  *avalue ));
    
    1157
    -    }
    
    1158
    -    else
    
    1159
    -    {
    
    1160
    -      delta = tt_var_get_item_delta( face,
    
    1161
    -                                     &table->itemStore,
    
    1162
    -                                     outerIndex,
    
    1163
    -                                     innerIndex );
    
    1136
    +    delta = tt_var_get_item_delta( face,
    
    1137
    +                                   &table->itemStore,
    
    1138
    +                                   outerIndex,
    
    1139
    +                                   innerIndex );
    
    1164 1140
     
    
    1141
    +    if ( delta ) {
    
    1165 1142
           FT_TRACE5(( "%s value %d adjusted by %d unit%s (%s)\n",
    
    1166 1143
                       vertical ? "vertical height" : "horizontal width",
    
    1167 1144
                       *avalue,
    
    ... ... @@ -1459,19 +1436,12 @@
    1459 1436
           FT_Int     delta;
    
    1460 1437
     
    
    1461 1438
     
    
    1462
    -      /* new test introduced in OpenType 1.8.4 */
    
    1463
    -      if ( value->outerIndex == 0xFFFFU && value->innerIndex == 0xFFFFU )
    
    1464
    -      {
    
    1465
    -        /* no variation data for this item */
    
    1466
    -        continue;
    
    1467
    -      }
    
    1468
    -
    
    1469 1439
           delta = tt_var_get_item_delta( face,
    
    1470 1440
                                          &blend->mvar_table->itemStore,
    
    1471 1441
                                          value->outerIndex,
    
    1472 1442
                                          value->innerIndex );
    
    1473 1443
     
    
    1474
    -      if ( p )
    
    1444
    +      if ( p && delta )
    
    1475 1445
           {
    
    1476 1446
             FT_TRACE5(( "value %c%c%c%c (%d unit%s) adjusted by %d unit%s (MVAR)\n",
    
    1477 1447
                         (FT_Char)( value->tag >> 24 ),
    


  • reply via email to

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