freetype-gl icon indicating copy to clipboard operation
freetype-gl copied to clipboard

removing some serious inefficiencies, fixing a change that broke compatibility with opengl < 3

Open slowriot opened this issue 11 years ago • 12 comments

See commit descriptions for more details.

slowriot avatar Sep 18 '14 08:09 slowriot

Could you make a new PR ?

rougier avatar Sep 18 '14 09:09 rougier

Have added a new commit re-adding the stretched matrix (in a tidier form) and added a control to toggle this behaviour on or off, as well as adding your links to the documentation for that control.

slowriot avatar Sep 18 '14 11:09 slowriot

Thanks. I won"t be avail for one week (no internet). I will test & merge once I'm back. Don't hesitate to ping me

rougier avatar Sep 18 '14 11:09 rougier

To disable horizontal hinting you can use hinting mode slight.

behdad avatar Sep 18 '14 13:09 behdad

@behdad you mean directly from freetype ? I get only FT_LOAD_NO_HINTING @slowriot I will test soon.

rougier avatar Oct 02 '14 17:10 rougier

@rougier Check FT_LOAD_TARGET_LIGHT

behdad avatar Oct 02 '14 17:10 behdad

Not quite sure this would be equivalent to horizontal hinting discard:

  • FT_RENDER_MODE_NORMAL This is the default render mode; it corresponds to 8-bit anti-aliased bitmaps.
  • FT_RENDER_MODE_LIGHT This is equivalent to FT_RENDER_MODE_NORMAL. It is only defined as a separate value because render modes are also used indirectly to define hinting algorithm selectors. See FT_LOAD_TARGET_XXX for details.

rougier avatar Oct 02 '14 18:10 rougier

   *   FT_LOAD_TARGET_LIGHT :: 
   *     A lighter hinting algorithm for non-monochrome modes.  Many 
   *     generated glyphs are more fuzzy but better resemble its original 
   *     shape.  A bit like rendering on Mac OS~X. 

Also, from aflatin.c:

    /* 
     *  In `light' hinting mode we disable horizontal hinting completely. 
     *  We also do it if the face is italic. 
     */ 
    if ( mode == FT_RENDER_MODE_LIGHT                      || 
         ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0 ) 
      scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL; 

behdad avatar Oct 02 '14 18:10 behdad

@behdad Thanks. @slowriot Might be a better solution, what do you think ?

rougier avatar Oct 03 '14 05:10 rougier

@rougier I personally think exposing as much of the underlying Freetype functionality to the user as possible is the best approach, so the user can select the right hinting mode for their application.

I also think the default behaviour should always be in accordance with the "principle of least surprise", with the user requesting any unexpected or special hinting modes specifically. In the case of the existing hack to suppress horizontal hinting, I personally was quite surprised when I came across it, so I think defaulting to a more standard mode would be better along with adding some mechanism of allowing the user to select the hinting mode they want. And documenting the font hinting behaviour much better! :)

slowriot avatar Oct 03 '14 14:10 slowriot

@slowriot You are right in principle. But horizontal hinting doesn't make sense in this case because the SDF is supposed to be size-independent.

behdad avatar Oct 03 '14 14:10 behdad

@behdad Freetype-gl isn't used exclusively with SDF rendering, and moreover why would you want to enable vertical hinting but not horizontal in that case? Either way the result is potentially surprising and unexpected to the user. Best case is that they don't notice anything is wrong; worst case is that text renders incorrectly without the user being given the option to switch behaviour.

slowriot avatar Oct 03 '14 16:10 slowriot