freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][svg_metrics] * src/cff/cffgload.c (cff_slot_loa


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][svg_metrics] * src/cff/cffgload.c (cff_slot_load): Simplify SVG metrics scaling.
Date: Thu, 20 Oct 2022 15:39:47 +0000

Alexei Podtelezhnikov pushed to branch svg_metrics at FreeType / FreeType

Commits:

  • 10c29150
    by Alexei Podtelezhnikov at 2022-10-20T15:39:43+00:00
    * src/cff/cffgload.c (cff_slot_load): Simplify SVG metrics scaling.

1 changed file:

Changes:

  • src/cff/cffgload.c
    ... ... @@ -356,17 +356,13 @@
    356 356
     
    
    357 357
     #ifdef FT_CONFIG_OPTION_SVG
    
    358 358
         /* check for OT-SVG */
    
    359
    -    if ( ( load_flags & FT_LOAD_COLOR )     &&
    
    360
    -         ( (TT_Face)glyph->root.face )->svg )
    
    359
    +    if ( ( load_flags & FT_LOAD_COLOR ) && face->svg )
    
    361 360
         {
    
    362 361
           /*
    
    363 362
            * We load the SVG document and try to grab the advances from the
    
    364 363
            * table.  For the bearings we rely on the presetting hook to do that.
    
    365 364
            */
    
    366 365
     
    
    367
    -      FT_Short      dummy;
    
    368
    -      FT_UShort     advanceX;
    
    369
    -      FT_UShort     advanceY;
    
    370 366
           SFNT_Service  sfnt;
    
    371 367
     
    
    372 368
     
    
    ... ... @@ -379,10 +375,18 @@
    379 375
     
    
    380 376
           FT_TRACE3(( "Trying to load SVG glyph\n" ));
    
    381 377
     
    
    382
    -      sfnt  = (SFNT_Service)((TT_Face)glyph->root.face)->sfnt;
    
    378
    +      sfnt  = (SFNT_Service)face->sfnt;
    
    383 379
           error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
    
    384 380
           if ( !error )
    
    385 381
           {
    
    382
    +        FT_Fixed  x_scale = size->root.metrics.x_scale;
    
    383
    +        FT_Fixed  y_scale = size->root.metrics.y_scale;
    
    384
    +
    
    385
    +        FT_Short   dummy;
    
    386
    +        FT_UShort  advanceX;
    
    387
    +        FT_UShort  advanceY;
    
    388
    +
    
    389
    +
    
    386 390
             FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
    
    387 391
     
    
    388 392
             glyph->root.format = FT_GLYPH_FORMAT_SVG;
    
    ... ... @@ -407,17 +411,8 @@
    407 411
             glyph->root.linearHoriAdvance = advanceX;
    
    408 412
             glyph->root.linearVertAdvance = advanceY;
    
    409 413
     
    
    410
    -        advanceX =
    
    411
    -          (FT_UShort)FT_MulDiv( advanceX,
    
    412
    -                                glyph->root.face->size->metrics.x_ppem,
    
    413
    -                                glyph->root.face->units_per_EM );
    
    414
    -        advanceY =
    
    415
    -          (FT_UShort)FT_MulDiv( advanceY,
    
    416
    -                                glyph->root.face->size->metrics.y_ppem,
    
    417
    -                                glyph->root.face->units_per_EM );
    
    418
    -
    
    419
    -        glyph->root.metrics.horiAdvance = advanceX << 6;
    
    420
    -        glyph->root.metrics.vertAdvance = advanceY << 6;
    
    414
    +        glyph->root.metrics.horiAdvance = FT_MulFix( advanceX, x_scale );
    
    415
    +        glyph->root.metrics.vertAdvance = FT_MulFix( advanceY, y_scale );
    
    421 416
     
    
    422 417
             return error;
    
    423 418
           }
    


  • reply via email to

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