Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClearType symmetric rendering #1080

Closed
dfrg opened this issue Aug 12, 2024 · 0 comments · Fixed by #1087
Closed

ClearType symmetric rendering #1080

dfrg opened this issue Aug 12, 2024 · 0 comments · Fixed by #1087

Comments

@dfrg
Copy link
Member

dfrg commented Aug 12, 2024

The TrueType interpreter has a GETINFO instruction that allows the font to query information about the state and capabilities of the rasterizer. Of interest here is bit 18 which is described as follows:

Bit 18 is set to 1 if ClearType symmetric rendering is being used (for MS Rasterizer v.2.0 and later).
Depending on the horizontal LCD stripe orientation, this can impact the rendering of horizontal
features. It is set to 0 otherwise.

FreeType always sets this to true when hinting for an anti-aliased target.

At some point in the Windows 10 era, the Calibri font (at least) was updated to query this bit and execute different instructions when enabled. As the note mentions, this does impact the rendering of horizontal features. Note the partially extended height of the top stem (rendered at 16px and zoomed 16x):

raster_ft

Skrifa currently produces the exact same output, but does better when that flag is disabled:

raster_skrifa

You can disable this in skrifa right now by enabling the preserve_linear_metrics setting but that can also affect horizontal rendering, so I propose that we add a new symmetric_rendering flag to control this directly, set to true by default to match FreeType.

It's conceivable that a supersampling rasterizer will handle this better (I assume ClearType does this when it sets this flag), but analytical area implementations do not.

cc @drott

@rsheeter rsheeter added this to the Skrifa for Chrome milestone Aug 12, 2024
@dfrg dfrg linked a pull request Aug 28, 2024 that will close this issue
dfrg added a commit that referenced this issue Aug 28, 2024
Replaces the current HintingMode with a new HintingOptions type to support autohinting. Specifically, it allows for selecting the hinting engine (interpreter, auto or auto fallback). Also reintroduces a "light" mode to match FT_RENDER_MODE_LIGHT since this actually represents a different mode in the autohinter (but didn't for TrueType or CFF).

Adds the symmetric_rendering flag as well (closes #1080).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants