freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [ftmulti] Enable overlap flag tes


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [ftmulti] Enable overlap flag testing.
Date: Sat, 11 Feb 2023 23:50:56 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

  • 46b5ae2d
    by Alexei Podtelezhnikov at 2023-02-11T18:30:39-05:00
    [ftmulti] Enable overlap flag testing.
    
    Variation fonts often relay on overlapping contours, which require
    oversampling to render properly. FreeType relies on FT_OUTLINE_OVERLAP
    to trigger the expensive mitigation algorithm. This commit enables
    tinkering with the overlap flags and, therefore, the oversampling.
    Normally, the flags should be set by the font designers sparingly.
    
    The bitmap strike toggle is no longer available, which has never
    been important for the variation font testing.
    
    * src/ftmulti.c (Process_Event): Reassign F4 to overlap toggle.
    (Render_Glyph): Tinker with the overlap flags before rendering.
    

1 changed file:

Changes:

  • src/ftmulti.c
    ... ... @@ -94,7 +94,7 @@
    94 94
       static int  hinted    = 1;         /* is glyph hinting active?    */
    
    95 95
       static int  grouping  = 1;         /* is axis grouping active?    */
    
    96 96
       static int  antialias = 1;         /* is anti-aliasing active?    */
    
    97
    -  static int  use_sbits = 1;         /* do we use embedded bitmaps? */
    
    97
    +  static int  overlaps  = 0x0;       /* flip overlap flags or not?  */
    
    98 98
       static int  Num;                   /* current first glyph index   */
    
    99 99
     
    
    100 100
       static int  res       = 72;
    
    ... ... @@ -103,8 +103,6 @@
    103 103
     
    
    104 104
       static int  Fail;
    
    105 105
     
    
    106
    -  static int  graph_init  = 0;
    
    107
    -
    
    108 106
       static int  render_mode = 1;
    
    109 107
     
    
    110 108
       static FT_MM_Var    *multimaster   = NULL;
    
    ... ... @@ -305,8 +303,6 @@
    305 303
         bit = (grBitmap*)surface;
    
    306 304
     
    
    307 305
         fore_color = grFindColor( bit, 255, 255, 255, 255 );  /* white */
    
    308
    -
    
    309
    -    graph_init = 1;
    
    310 306
       }
    
    311 307
     
    
    312 308
     
    
    ... ... @@ -322,6 +318,10 @@
    322 318
         /* first, render the glyph image into a bitmap */
    
    323 319
         if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
    
    324 320
         {
    
    321
    +      /* overlap flags mitigate AA rendering artifacts in overlaps */
    
    322
    +      /* by oversampling, toggle the flag to test the effect       */
    
    323
    +      glyph->outline.flags ^= overlaps;
    
    324
    +
    
    325 325
           error = FT_Render_Glyph( glyph, antialias ? FT_RENDER_MODE_NORMAL
    
    326 326
                                                     : FT_RENDER_MODE_MONO );
    
    327 327
           if ( error )
    
    ... ... @@ -373,14 +373,11 @@
    373 373
         int  flags;
    
    374 374
     
    
    375 375
     
    
    376
    -    flags = FT_LOAD_DEFAULT;
    
    376
    +    flags = FT_LOAD_NO_BITMAP;
    
    377 377
     
    
    378 378
         if ( !hint )
    
    379 379
           flags |= FT_LOAD_NO_HINTING;
    
    380 380
     
    
    381
    -    if ( !use_sbits )
    
    382
    -      flags |= FT_LOAD_NO_BITMAP;
    
    383
    -
    
    384 381
         return FT_Load_Glyph( face, idx, flags );
    
    385 382
       }
    
    386 383
     
    
    ... ... @@ -558,7 +555,7 @@
    558 555
         grWriteln( "q, ESC      quit ftmulti" );
    
    559 556
         grWriteln( "F2          toggle axis grouping" );
    
    560 557
         grWriteln( "F3          toggle outline hinting" );
    
    561
    -    grWriteln( "F4          toggle embedded bitmaps" );
    
    558
    +    grWriteln( "F4          toggle overlap flags" );
    
    562 559
         grWriteln( "F5          toggle anti-aliasing" );
    
    563 560
         grWriteln( "F6          cycle through hinting engines (if available)" );
    
    564 561
         grLn();
    
    ... ... @@ -645,10 +642,10 @@
    645 642
           break;
    
    646 643
     
    
    647 644
         case grKeyF4:
    
    648
    -      use_sbits  = !use_sbits;
    
    649
    -      new_header = use_sbits
    
    650
    -                     ? "embedded bitmaps are now used if available"
    
    651
    -                     : "embedded bitmaps are now ignored";
    
    645
    +      overlaps  ^= FT_OUTLINE_OVERLAP;
    
    646
    +      new_header = overlaps
    
    647
    +                     ? "overlap flags are flipped"
    
    648
    +                     : "overlap flags are unchanged";
    
    652 649
           break;
    
    653 650
     
    
    654 651
         case grKEY( ',' ):
    


  • reply via email to

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