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.
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.
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.