googlefonts / googlefonts/fontc
Handle overlaps when compiling static fonts
- Dominant language
- Rust
- Stars
- 193
- Forks
- 21
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 60
Description
Overlaps produce cutouts when drawn with evenodd fill. Apparently older versions of macos and _maybe_ some printers do this.
When compiling a static (non-variable) font do at least one of:
* At least set OVERLAP_SIMPLE (only if there are overlaps?), https://learn.microsoft.com/en-us/typography/opentype/spec/glyf
* Actually remove the overlaps.
* No Rust implementation equivalent ot Skia pathops appears to exist, would likely have to call into pathops
* @simoncozens https://github.com/simoncozens/rust-font-tools/blob/main/fonttools-cli/src/bin/ttf-remove-overlap.rs does this via https://docs.rs/crate/skia-safe/latest
The importance of actually removing the overlaps is a bit unclear to me. It used to be done for macos but now we have the overlap simple flag. Rumor has it that old printers might need actual removal but I don't have specific examples.
References:
* https://github.com/fonttools/fonttools/issues/2059 discusses FreeType and Microsoft handling
* https://github.com/google/fonts/issues/2602#issuecomment-679031978
* https://twardoch.github.io/test-fonts/varia/160413-EvenOddTT/
Contributor guide
No contributing guide indexed for this repository
Research direction
No repository file or test is named. Start with the OpenType glyf OVERLAP_SIMPLE specification and the referenced rust-font-tools ttf-remove-overlap implementation, then inspect fontc's static-font compilation path. Done means static fonts handle overlapping outlines by setting the appropriate flag or removing overlaps, with behavior validated against the reported evenodd rendering cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100