Skip to content

expose font metrics (ascender / descender etc) #107

Open
@cmyr

Description

@cmyr

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions