Use TextMetrics properties for piet-web linebreaking
Open
@hwchen is already working on this.
Since Apr 9, 2020.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
For linebreaking, piet needs to be able to get the height and baseline of a line.
In piet-web, the best way to do this should be through web_sys::CanvasRenderingContext2d::measure_text, which returns TextMetrics.
However, TextMetrics currently has only width as a property. All other baseline and height related properties are more recent additions to the web api.
There's an issue open, hopefully the bindings will be updated. https://github.com/rustwasm/wasm-bindgen/issues/2069
Until then, the piet-web uses some heuristics to guess at line height and baseline.
Contributor guide
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.
Assessment
This issue has not been assessed yet.