expose font metrics (ascender / descender etc)
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
I'm sure this is on some font roadmap I'm too lazy to look for, so feel free to close as a dupe if appropriate:
When drawing text (via `RenderCtx::draw_text`) we supply a position where the text should draw. This is an origin in "text space", that is with `(0,0)` at the intersection of the baseline with the left edge.
Unfortunately, there's no way to know where the baseline is relative to the overall height. (There's also no real way of getting the overall height, afaict, although what "height" means is not well defined; I would settle for "the union of the bounding boxes of all glyphs in the font").
Anyway: this is more a practical issue than a font-metaphysics issue. It would be nice if we could, in the general case, draw some text in a box with equal padding on the top and bottom. A reasonable first step for this would be exposing general metrics like ascender/descender.
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.
Research direction
Start with the RenderCtx::draw_text entry point and trace how text positioning and font data are represented. Define the exposed font metrics, including ascender and descender, and verify that callers can determine the baseline and glyph bounds needed for padded text layout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100