googlefonts / googlefonts/fontations

[skrifa] CJK autohinting weirdness

Open
#1,129 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
827
Forks
76
Avg merge
22h 33m
Merged PRs (30d)
75

Description

Some confusing bits in the FreeType CJK autohinter.

1. Scaled/fitted values are never generated for stem widths so they're always 0.
https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afcjk.c#L661

2. There's an extra loop to detect round segments that is never executed because the pointer to the segments array is captured (as NULL) before the segments array is actually allocated (by the call to `af_latin_hints_compute_segments`).
https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/autofit/afcjk.c#L808

We'll just match this behavior for now but should investigate later to see what's going on.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the CJK autohinter logic in src/autofit/afcjk.c at the linked stem-width and round-segment sections. Trace how af_latin_hints_compute_segments allocates the segments array and determine whether the port should preserve the observed FreeType behavior or correct it. Done means the intended behavior is documented or covered by a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.