linebender / linebender/piet

Use TextMetrics properties for piet-web linebreaking

Open
#165 0 comments 0 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.