Skip to content

skrifa: Ability to enable horizontal hinting #1215

Open
@mahkoh

Description

@mahkoh

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

if self.is_hinted
&& component
.flags
.contains(CompositeGlyphFlags::ROUND_XY_TO_GRID)
{
// Only round the y-coordinate, per FreeType.
offset.y = offset.y.round();
}

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions