Skip to content

[css-values] baseline-position unit? #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tbredin opened this issue Oct 28, 2016 · 3 comments
Open

[css-values] baseline-position unit? #661

tbredin opened this issue Oct 28, 2016 · 3 comments

Comments

@tbredin
Copy link

tbredin commented Oct 28, 2016

I've just found out about the ch and ex units described here:
https://www.w3.org/TR/css3-values/#relative-lengths

Baseline position: (perhaps in a format like top: 1bpos for example) would give us information on the vertical position of the baseline relative to the top of the box model (without padding?) for a given font. This position varies a lot from one font to another

This is something that could become extremely useful in vertical rhythm projects such as Sassline and MegaType, which go to great length to attempt to find this position through other means. When combined with ex (and a speculative cap height), we also start to build up a very useful picture of a font's vertical metrics.

Is this something that might be considered in future?
Further reading on some existing issues with typographic metrics on the web

@upsuper
Copy link
Member

upsuper commented Oct 28, 2016

Relative to the top of its container? That is infeasible, because that would make its value depend on layout result, which would lead to cyclic dependency. It is possible, though, to get the baseline position based on the first font in font-family, but I guess that's not what you are looking for.

@SelenIT
Copy link
Collaborator

SelenIT commented Nov 5, 2016

I suppose it would be useful to have access to ascent and descent metrics from the font (and cap height, too, if possible) as font-relative units. Combined with font-size and calc() function, this would enable better control over line box formation and aligning things with text (including, but not limited to, calculating the baseline position).

@xfq
Copy link
Member

xfq commented Aug 26, 2018

Related: Font Metrics API

@fantasai fantasai added css-values-5 and removed css-values-4 Current Work labels Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants