Skip to content

Conversation

@Omikhleia
Copy link
Member

@Omikhleia Omikhleia commented Sep 7, 2025

The "cap" unit is proposed in CSS4 Draft and makes sense for cap-height font adjustement.
Both "ex" and "cap" shall be based on font metrics when available, and only measure a character as a fallback heuristic.
Some fonts may not have the necessary Latin characters, in which case we shall resorti to a decent fallback (as per CSS recommendations).

Closes #2317

Note 1: Obviously this only takes all its value with PR #2319

Note 2: Some fonts have small differences between the sxHeight metric and the measured height of a lowercase “x”.
As a result, several regression tests (e.g., those using Libertinus Serif) will fail.
Minor variations in output are also to be expected.
But if I have interpreted the issue correctly, this represents better typography — and I am weighting for it.

@Omikhleia Omikhleia added this to the v0.15.14 milestone Sep 7, 2025
@Omikhleia Omikhleia self-assigned this Sep 7, 2025
@Omikhleia Omikhleia requested a review from alerque as a code owner September 7, 2025 16:23
@Omikhleia Omikhleia added bug Software bug issue enhancement Software improvement or feature request labels Sep 7, 2025
@Omikhleia Omikhleia force-pushed the fix-correct-ex-unit branch 3 times, most recently from 8c6645a to 37c136c Compare September 7, 2025 16:41
The "cap" unit is proposed in CSS4 Draft and makes sense for cap-height
font adjustement.
Both "ex" and "cap" shall be based on font metrics when available, and
only measure a character as a fallback heuristic.
Some fonts may not have the necessary Latin characters, in which case
we shall resorti to a decent fallback (as per CSS recommendations).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Software bug issue enhancement Software improvement or feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reconsider how the ex unit is computed

2 participants