`properties()` only returns properties for single font variation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 840
- Forks
- 137
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 1
Description
Consider the following font: http://0x0.st/8yNw.ttf (uploading to 0x0.st, since GitHub won't let me upload it here). This file is a single font with variation on the weight axis, and the Windows font viewer says it contains ExtraLight, Light, Normal, Medium, Semibold, Bold, ExtraBold -- i.e. all weights from 200 to 800. Some quick testing with ttf_parser shows that this is indeed the case.
When loaded, though, currently this information is lost, and only the default variation is returned (400.0).
For reference, this is what I'm trying:
let data = std::fs::read("AtkinsonHyperlegibleNext-VariableFont_wght.ttf").unwrap();
let handle = font_kit::handle::Handle::Memory {
bytes: Arc::new(data),
font_index: 0,
};
let props = handle.load().unwrap().properties();
eprintln!("{props:?}");
I'm not saying that properties should return all variations, but maybe there should be additional APIs for querying this information...?
Maybe I'm missing something obvious. I've only discovered this bug last night and the research I've done since then doesn't make me an OpenType expert.
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 at the Handle::load().properties() path in font-kit and inspect how the loaded font's variation data is represented. Use the linked variable font and the reported Rust example to reproduce the loss of weight-axis values, then review the existing API and ttf_parser findings to determine what queryable variation information should be exposed. Done means the relevant variation data is available through a documented API with coverage for this font.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100