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] Limit INSTCTRL ap


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: [truetype] Limit INSTCTRL appication within specs.
Date: Sun, 12 Dec 2021 03:30:36 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • src/truetype/ttgload.c
    ... ... @@ -2719,8 +2719,35 @@
    2719 2719
           /* note that this flag can also be modified in a glyph's bytecode */
    
    2720 2720
           if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
    
    2721 2721
                exec->GS.instruct_control & 4                            )
    
    2722
    -        exec->ignore_x_mode = 0;
    
    2723
    -#endif
    
    2722
    +        exec->ignore_x_mode = FALSE;
    
    2723
    +
    
    2724
    +      exec->iup_called = FALSE;
    
    2725
    +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    2726
    +
    
    2727
    +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    2728
    +      /*
    
    2729
    +       * Toggle backward compatibility according to what font wants, except
    
    2730
    +       * when
    
    2731
    +       *
    
    2732
    +       * 1) we have a `tricky' font that heavily relies on the interpreter to
    
    2733
    +       *    render glyphs correctly, for example DFKai-SB, or
    
    2734
    +       * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
    
    2735
    +       *
    
    2736
    +       * In those cases, backward compatibility needs to be turned off to get
    
    2737
    +       * correct rendering.  The rendering is then completely up to the
    
    2738
    +       * font's programming.
    
    2739
    +       *
    
    2740
    +       */
    
    2741
    +      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
    
    2742
    +           subpixel_hinting_lean                                    &&
    
    2743
    +           !FT_IS_TRICKY( glyph->face )                             )
    
    2744
    +        exec->backward_compatibility = !( exec->GS.instruct_control & 4 );
    
    2745
    +      else
    
    2746
    +        exec->backward_compatibility = FALSE;
    
    2747
    +
    
    2748
    +      exec->iupx_called = FALSE;
    
    2749
    +      exec->iupy_called = FALSE;
    
    2750
    +#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
    
    2724 2751
     
    
    2725 2752
           exec->pedantic_hinting = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
    
    2726 2753
           loader->exec = exec;
    

  • src/truetype/ttinterp.c
    ... ... @@ -5260,16 +5260,21 @@
    5260 5260
           }
    
    5261 5261
         }
    
    5262 5262
     
    
    5263
    -    exc->GS.instruct_control &= ~(FT_Byte)Kf;
    
    5264
    -    exc->GS.instruct_control |= (FT_Byte)L;
    
    5263
    +    /* INSTCTRL should only be used in the CVT program */
    
    5264
    +    if ( exc->iniRange == tt_coderange_cvt )
    
    5265
    +    {
    
    5266
    +      exc->GS.instruct_control &= ~(FT_Byte)Kf;
    
    5267
    +      exc->GS.instruct_control |= (FT_Byte)L;
    
    5268
    +    }
    
    5265 5269
     
    
    5266
    -    if ( K == 3 )
    
    5270
    +    /* except to change the subpixel flags temporarily */
    
    5271
    +    else if ( exc->iniRange == tt_coderange_glyph && K == 3 )
    
    5267 5272
         {
    
    5268 5273
     #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    5269 5274
           /* INSTCTRL modifying flag 3 also has an effect */
    
    5270 5275
           /* outside of the CVT program                   */
    
    5271 5276
           if ( SUBPIXEL_HINTING_INFINALITY )
    
    5272
    -        exc->ignore_x_mode = FT_BOOL( L == 4 );
    
    5277
    +        exc->ignore_x_mode = !FT_BOOL( L == 4 );
    
    5273 5278
     #endif
    
    5274 5279
     
    
    5275 5280
     #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    ... ... @@ -5280,6 +5285,8 @@
    5280 5285
             exc->backward_compatibility = !FT_BOOL( L == 4 );
    
    5281 5286
     #endif
    
    5282 5287
         }
    
    5288
    +    else if ( exc->pedantic_hinting )
    
    5289
    +      exc->error = FT_THROW( Invalid_Reference );
    
    5283 5290
       }
    
    5284 5291
     
    
    5285 5292
     
    
    ... ... @@ -7755,35 +7762,6 @@
    7755 7762
     #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    7756 7763
     
    
    7757 7764
     
    
    7758
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
    
    7759
    -    exc->iup_called = FALSE;
    
    7760
    -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
    
    7761
    -
    
    7762
    -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
    
    7763
    -    /*
    
    7764
    -     * Toggle backward compatibility according to what font wants, except
    
    7765
    -     * when
    
    7766
    -     *
    
    7767
    -     * 1) we have a `tricky' font that heavily relies on the interpreter to
    
    7768
    -     *    render glyphs correctly, for example DFKai-SB, or
    
    7769
    -     * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
    
    7770
    -     *
    
    7771
    -     * In those cases, backward compatibility needs to be turned off to get
    
    7772
    -     * correct rendering.  The rendering is then completely up to the
    
    7773
    -     * font's programming.
    
    7774
    -     *
    
    7775
    -     */
    
    7776
    -    if ( SUBPIXEL_HINTING_MINIMAL          &&
    
    7777
    -         exc->subpixel_hinting_lean        &&
    
    7778
    -         !FT_IS_TRICKY( &exc->face->root ) )
    
    7779
    -      exc->backward_compatibility = !( exc->GS.instruct_control & 4 );
    
    7780
    -    else
    
    7781
    -      exc->backward_compatibility = FALSE;
    
    7782
    -
    
    7783
    -    exc->iupx_called = FALSE;
    
    7784
    -    exc->iupy_called = FALSE;
    
    7785
    -#endif
    
    7786
    -
    
    7787 7765
         /* We restrict the number of twilight points to a reasonable,     */
    
    7788 7766
         /* heuristic value to avoid slow execution of malformed bytecode. */
    
    7789 7767
         num_twilight_points = FT_MAX( 30,
    


  • reply via email to

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