removing some serious inefficiencies, fixing a change that broke compatibility with opengl < 3
See commit descriptions for more details.
Could you make a new PR ?
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.
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
To disable horizontal hinting you can use hinting mode slight.
@behdad you mean directly from freetype ? I get only FT_LOAD_NO_HINTING @slowriot I will test soon.
@rougier Check FT_LOAD_TARGET_LIGHT
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.
* 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 Thanks. @slowriot Might be a better solution, what do you think ?
@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 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 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.