freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [autofit] Updated to reduce casting (co


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [autofit] Updated to reduce casting (cont'd).
Date: Mon, 01 Aug 2022 17:25:42 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • a18ad83e
    by Alexei Podtelezhnikov at 2022-08-01T13:20:13-04:00
    [autofit] Updated to reduce casting (cont'd).
    
    * src/autofit/afmodule.h (AF_ModuleRec): Change `default_script` type.
    * src/autofit/afglobal.c (af_face_globals_compute_style_coverage):
    Remove casting.
    * src/autofit/afmodule.c (af_property_{set,get}): Updated accordingly.
    

3 changed files:

Changes:

  • src/autofit/afglobal.c
    ... ... @@ -168,8 +168,7 @@
    168 168
            */
    
    169 169
           if ( style_class->coverage == AF_COVERAGE_DEFAULT )
    
    170 170
           {
    
    171
    -        if ( (FT_UInt)style_class->script ==
    
    172
    -             globals->module->default_script )
    
    171
    +        if ( style_class->script == globals->module->default_script )
    
    173 172
               dflt = ss;
    
    174 173
     
    
    175 174
             for ( range = script_class->script_uni_ranges;
    

  • src/autofit/afmodule.c
    ... ... @@ -119,8 +119,8 @@
    119 119
     
    
    120 120
         if ( !ft_strcmp( property_name, "fallback-script" ) )
    
    121 121
         {
    
    122
    -      FT_UInt*  fallback_script;
    
    123
    -      FT_UInt   ss;
    
    122
    +      AF_Script*  fallback_script;
    
    123
    +      FT_UInt     ss;
    
    124 124
     
    
    125 125
     
    
    126 126
     #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
    
    ... ... @@ -128,7 +128,7 @@
    128 128
             return FT_THROW( Invalid_Argument );
    
    129 129
     #endif
    
    130 130
     
    
    131
    -      fallback_script = (FT_UInt*)value;
    
    131
    +      fallback_script = (AF_Script*)value;
    
    132 132
     
    
    133 133
           /* We translate the fallback script to a fallback style that uses */
    
    134 134
           /* `fallback-script' as its script and `AF_COVERAGE_NONE' as its  */
    
    ... ... @@ -138,8 +138,8 @@
    138 138
             AF_StyleClass  style_class = af_style_classes[ss];
    
    139 139
     
    
    140 140
     
    
    141
    -        if ( (FT_UInt)style_class->script == *fallback_script &&
    
    142
    -             style_class->coverage == AF_COVERAGE_DEFAULT     )
    
    141
    +        if ( style_class->script   == *fallback_script    &&
    
    142
    +             style_class->coverage == AF_COVERAGE_DEFAULT )
    
    143 143
             {
    
    144 144
               module->fallback_style = ss;
    
    145 145
               break;
    
    ... ... @@ -157,7 +157,7 @@
    157 157
         }
    
    158 158
         else if ( !ft_strcmp( property_name, "default-script" ) )
    
    159 159
         {
    
    160
    -      FT_UInt*  default_script;
    
    160
    +      AF_Script*  default_script;
    
    161 161
     
    
    162 162
     
    
    163 163
     #ifdef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
    
    ... ... @@ -165,7 +165,7 @@
    165 165
             return FT_THROW( Invalid_Argument );
    
    166 166
     #endif
    
    167 167
     
    
    168
    -      default_script = (FT_UInt*)value;
    
    168
    +      default_script = (AF_Script*)value;
    
    169 169
     
    
    170 170
           module->default_script = *default_script;
    
    171 171
     
    
    ... ... @@ -291,8 +291,6 @@
    291 291
       {
    
    292 292
         FT_Error   error          = FT_Err_Ok;
    
    293 293
         AF_Module  module         = (AF_Module)ft_module;
    
    294
    -    FT_UInt    fallback_style = module->fallback_style;
    
    295
    -    FT_UInt    default_script = module->default_script;
    
    296 294
     
    
    297 295
     
    
    298 296
         if ( !ft_strcmp( property_name, "glyph-to-script-map" ) )
    
    ... ... @@ -309,9 +307,9 @@
    309 307
         }
    
    310 308
         else if ( !ft_strcmp( property_name, "fallback-script" ) )
    
    311 309
         {
    
    312
    -      FT_UInt*  val = (FT_UInt*)value;
    
    310
    +      AF_Script*  val = (AF_Script*)value;
    
    313 311
     
    
    314
    -      AF_StyleClass  style_class = af_style_classes[fallback_style];
    
    312
    +      AF_StyleClass  style_class = af_style_classes[module->fallback_style];
    
    315 313
     
    
    316 314
     
    
    317 315
           *val = style_class->script;
    
    ... ... @@ -320,10 +318,10 @@
    320 318
         }
    
    321 319
         else if ( !ft_strcmp( property_name, "default-script" ) )
    
    322 320
         {
    
    323
    -      FT_UInt*  val = (FT_UInt*)value;
    
    321
    +      AF_Script*  val = (AF_Script*)value;
    
    324 322
     
    
    325 323
     
    
    326
    -      *val = default_script;
    
    324
    +      *val = module->default_script;
    
    327 325
     
    
    328 326
           return error;
    
    329 327
         }
    

  • src/autofit/afmodule.h
    ... ... @@ -36,7 +36,7 @@ FT_BEGIN_HEADER
    36 36
         FT_ModuleRec  root;
    
    37 37
     
    
    38 38
         FT_UInt       fallback_style;
    
    39
    -    FT_UInt       default_script;
    
    39
    +    AF_Script     default_script;
    
    40 40
         FT_Bool       no_stem_darkening;
    
    41 41
         FT_Int        darken_params[8];
    
    42 42
     
    


  • reply via email to

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