by crazygringo · 5y ago · 0 comments
As the author states, sizing of fonts and line spacing is currently inconsistent across OS's, inconsistent across fonts, and inconsistent with other UI elements.
It's madness. There's no good reason for any of it except inertia and lack of forethought.
The author's proposal to specify cap height is really the only reasonable solution I think there is, though I'd modify it slightly:
- When defining cap height, be clear what the logical obvious equivalent in other scripts, e.g. Chinese logogram height
- Specify cap height in whatever unit other UI elements are specified in (the author refers to pixels, but that's arbitrary)
- Then line height can also be controlled predictably and exactly in whatever unit UI elements are specified in
End result: zero inconsistencies. Text shows up exactly where it's meant to no matter what.
How do we get there? Browsers should adopt it first, with something like a CSS "font-cap-size" property that can be used instead of (and override) "font-size", as well as something like "cap-line-height" overriding "line-height". (And for units, recommend using "px", or "rem" ultimately based on a root "px", and never touching "pt".)
Then OSes can migrate similarly with new function calls/parameters based on cap height, and also try to phase out "pt" sizing in preference of the logical "px" sizing used in the rest of interfaces.
I really think this is the way. I really hope browsers and the W3C can consider something like this. It's decades overdue.
What do you mean!? Forethought!? That's BDUF! YAGNI! This is the problem with you damn tech weenies: all you want to do is fix things and think!
There is no business value to fixing this problem. Ship! Ship! Ship! Ship! We need to float the IPO or SPAC or...something so we can all get RICH! Who cares if the damn font system is broken!? I don't remember seeing a story card or epic for that in Jira.
Now, there has to be -- like -- hundreds of blockers in Jira you should be working on right now instead of futzing with the tech bullshit.
</sarcasm>
On a serious note: is it possible there's a reason why everything is just slightly shit?
Wondering, do fonts need to be adapted to support this? Is the property 'cap height' typically available in fonts? X-height is.
Ya. I wrote a baseline-aware layout manager 12+ years ago. So much futzing to make a pixel perfect, general purpose solution.
I really thought this font and UI stuff would be settled (ancient history) by now.
I'm very grateful to Nikita (tonksy) for tackling these issues.
If you could turn a paperback sideways and have the text flip it would look pretty bad - lots of the layout and text is either hard-coded or even manually applied based on the physical format.
The real story is more complicated. Yes there is no 'em size' as a physical constraint in digital world. Yet the concept that the 'em size' represents is very important for a font. Font is more than the collection of glyphs (shapes of letters). Things like em size and default line height may seem arbitrary but they are important decisions made by font designer that should be respected by users of the font.