all_fonts throws too much information away
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 840
- Forks
- 137
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 1
Description
DirectWrite, Chrome and many other applications consider variable font instances to be different font faces. However the all_fonts iterator gets completely confused by this.
When it accesses the font count here, this is includes the font instances:
https://github.com/servo/font-kit/blob/1bfbc93b4e3ae759fb6da198505d1821213facb2/src/sources/directwrite.rs#L43
The dwrite_font then still understands that we are talking about the specific font instance index, not a font face index:
https://github.com/servo/font-kit/blob/1bfbc93b4e3ae759fb6da198505d1821213facb2/src/sources/directwrite.rs#L44
However when it gets turned into the font handle:
https://github.com/servo/font-kit/blob/1bfbc93b4e3ae759fb6da198505d1821213facb2/src/sources/directwrite.rs#L45
It turns the whole thing into a path + font face index pair, which completely throws away all the font instance information, meaning that for certain fonts, the iterator contains the same handle many times.
I'd say the iterator should either iterate over pairs of the handle and the font instance name or index, or that information should be part of the handle.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/sources/directwrite.rs at the font count, dwrite_font, and font-handle conversion linked in the issue. Trace how variable font instance indices are represented and determine whether all_fonts should preserve them in the handle or return them alongside it. Done means distinct variable font instances are no longer collapsed into repeated handles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- desktop-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100