-
Notifications
You must be signed in to change notification settings - Fork 708
[css-values] Fallback value of ex height #5243
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
Comments
I'm a bit surprised by the 0.8em figure here; from what I see in the Firefox code, there are a few fallback options used on various platforms, including 0.5em (on Freetype-based platforms, Linux and Android) or 0.56*ascent (on macOS), or examining the actual ink bounds of an 'x' glyph if present. It may also use a value retrieved from OS font APIs (directwrite, core text), in which case exactly where the value comes from is opaque to us. (A lot of this is, I think, historical baggage that could be cleaned up without too much harm.)
Perhaps worth noting that the x-height measurement is also important as an input to (FWIW, of the various fallbacks present in different parts of the Firefox code, I suspect the 0.56*ascent value was probably the one based most directly on observation of what worked well with actual fonts.) |
I'd derived that 0.8em figure a couple of years back, when I was still delving into font-metrics - I'd be a more specific about the platforms and fonts I tested with these days, not least because I now understand the variation across them! It's certainly based on the metrics tested on my Mac, and possibly not verified on other platforms. |
WebKit does: Glyph xGlyph = glyphForCharacter('x');
if (xGlyph)
xHeight = -CGRectGetMinY(platformBoundsForGlyph(xGlyph));
else
xHeight = CTFontGetXHeight(m_platformData.font());
The spec should be flexible enough to:
|
Fwiw, current spec text is
|
I've made some versions of Ahem with the "OS2.sxHeight" set to 0, and put a testcase up at https://jsbin.com/lexuren/edit?html,output |
Some pointers to Gecko code: the default of 0.56 and places that use it and the freetype code that doesn't use it and uses 0.5 instead. |
My apologies, I've sent this off in the wrong direction. On my Mac, when the OS2.sxHeight is set to 0 it appears to be falling back to some other metric in the font, which happens to be 0.8em. I haven't yet figured out which metric it is. |
Hi @faceless2
It depends entirely on the specific font. 0.8em is approximately the cap-height for some. AND: what is needed is an actual font-x-size: property that sets the font size BASED ON the font's x-height, not the other way around. !!! |
@Myndex You're looking for Anyway, I'm closing out this issue since afaict, the spec doesn't need any changes. |
I am quite familiar with font-size-adjust, it does not do nor behave in the way needed for directly setting font size. |
In #814 (comment) @faceless2 wrote:
which does in fact deserve a post on its own. :)
The text was updated successfully, but these errors were encountered: