freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] [sdf] Fix SDF positioning.


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] [sdf] Fix SDF positioning.
Date: Wed, 09 Jun 2021 14:41:11 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

3 changed files:

Changes:

  • ChangeLog
    1
    +2021-06-09  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[sdf] Fix SDF positioning.
    
    4
    +
    
    5
    +	* src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Add padding to
    
    6
    +	`bitmap_top' and `bitmap_left'.
    
    7
    +
    
    8
    +	* sdf/sdf/ftsdf.c (sdf_generate_with_overlaps): Fix VC++ warning.
    
    9
    +
    
    1 10
     2021-06-08  Werner Lemberg  <wl@gnu.org>
    
    2 11
     
    
    3 12
     	Fix 'devel' build for COLR 'v1'.
    

  • src/sdf/ftsdf.c
    ... ... @@ -3520,6 +3520,11 @@
    3520 3520
         if ( !shape || !bitmap || !shape->memory )
    
    3521 3521
           return FT_THROW( Invalid_Argument );
    
    3522 3522
     
    
    3523
    +    /* Disable `flip_sign` to avoid extra complication */
    
    3524
    +    /* during the combination phase.                   */
    
    3525
    +    flip_sign                 = internal_params.flip_sign;
    
    3526
    +    internal_params.flip_sign = 0;
    
    3527
    +
    
    3523 3528
         contour           = shape->contours;
    
    3524 3529
         memory            = shape->memory;
    
    3525 3530
         temp_shape.memory = memory;
    
    ... ... @@ -3544,11 +3549,6 @@
    3544 3549
                        (FT_UInt)num_contours * sizeof ( *orientations ) ) )
    
    3545 3550
           goto Exit;
    
    3546 3551
     
    
    3547
    -    /* Disable `flip_sign` to avoid extra complication */
    
    3548
    -    /* during the combination phase.                   */
    
    3549
    -    flip_sign                 = internal_params.flip_sign;
    
    3550
    -    internal_params.flip_sign = 0;
    
    3551
    -
    
    3552 3552
         contour = shape->contours;
    
    3553 3553
     
    
    3554 3554
         /* Iterate over all contours and generate SDF separately. */
    

  • src/sdf/ftsdfrend.c
    ... ... @@ -323,8 +323,11 @@
    323 323
     
    
    324 324
         slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
    
    325 325
     
    
    326
    -    x_shift  = 64 * -( slot->bitmap_left - x_pad );
    
    327
    -    y_shift  = 64 * -( slot->bitmap_top + y_pad );
    
    326
    +    slot->bitmap_top  += y_pad;
    
    327
    +    slot->bitmap_left -= x_pad;
    
    328
    +
    
    329
    +    x_shift  = 64 * -slot->bitmap_left;
    
    330
    +    y_shift  = 64 * -slot->bitmap_top;
    
    328 331
         y_shift += 64 * (FT_Int)bitmap->rows;
    
    329 332
     
    
    330 333
         if ( origin )
    
    ... ... @@ -520,7 +523,7 @@
    520 523
         y_pad = sdf_module->spread;
    
    521 524
     
    
    522 525
         /* apply padding, which extends to all directions */
    
    523
    -    target.rows  = bitmap->rows + y_pad * 2;
    
    526
    +    target.rows  = bitmap->rows  + y_pad * 2;
    
    524 527
         target.width = bitmap->width + x_pad * 2;
    
    525 528
     
    
    526 529
         /* set up the target bitmap */
    
    ... ... @@ -553,6 +556,8 @@
    553 556
           }
    
    554 557
     
    
    555 558
           slot->bitmap           = target;
    
    559
    +      slot->bitmap_top      += y_pad;
    
    560
    +      slot->bitmap_left     -= x_pad;
    
    556 561
           slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
    
    557 562
         }
    
    558 563
         else if ( target.buffer )
    


  • reply via email to

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