fontations icon indicating copy to clipboard operation
fontations copied to clipboard

skrifa: Ability to enable horizontal hinting

Open mahkoh opened this issue 1 year ago • 6 comments

skrifa currently only rounds the Y coordinate if ROUND_XY_TO_GRID is set:

https://github.com/googlefonts/fontations/blob/40329a215086ab2227e516ad8af125a74a4c4f07/skrifa/src/outline/glyf/mod.rs#L854-L861

However, freetype allows users to also enable X rounding:

        if ( subglyph->flags & ROUND_XY_TO_GRID )
        {
          if ( IS_HINTED( loader->load_flags ) )
          {
            if ( driver->interpreter_version == TT_INTERPRETER_VERSION_35 )
              x = FT_PIX_ROUND( x );

            y = FT_PIX_ROUND( y );
          }
        }

This is controlled by the interpreter-version setting. ~This setting has no other effects in current freetype versions.~ Correction: this setting has an effect in some other places, it disables subpixel hinting.

Users can set this setting with environment variables:

export FREETYPE_PROPERTIES=truetype:interpreter-version=35

This is the only way to modify this setting for users.

Would it be possible to have skrifa also interpret the FREETYPE_PROPERTIES environment variable and enable X rounding as freetype does? I'd be willing to implement this.

Some other way to enable X rounding would also be fine, as long as it is under the control of users running programs using skrifa and does require modifying source code.

mahkoh avatar Nov 01 '24 11:11 mahkoh

The required changes go a bit deeper than what is suggested here. In particular, the version 35 interpreter changes the behavior of several instructions.

After some internal discussion, this seems like something we should support so I’ll schedule some time soon to get it done.

dfrg avatar Nov 02 '24 00:11 dfrg

That is great news! Thank you very much.

mahkoh avatar Nov 02 '24 06:11 mahkoh

@dfrg

Any updates on this? It's been more than half a year.

I'm really missing FREETYPE_PROPERTIES=truetype:interpreter-version=35

birdie-github avatar May 02 '25 11:05 birdie-github

I'm currently working on implementing this. Should be ready within a few days.

mahkoh avatar May 13 '25 12:05 mahkoh

https://github.com/googlefonts/fontations/pull/1496

mahkoh avatar May 13 '25 17:05 mahkoh

Do I have to pay someone to enable FREETYPE_PROPERTIES=truetype:interpreter-version=35 on Skrifa? Since Chrome uses Skrifa my eyes are bleeding from these ugly fonts, I really want FREETYPE_PROPERTIES=truetype:interpreter-version=35 in my browser back as it is on my whole system.

funeralium667 avatar Oct 27 '25 19:10 funeralium667