-
Notifications
You must be signed in to change notification settings - Fork 707
[css-inline] Define the content area of inline boxes #814
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
If you want the ability to make the border-box height of an inline fill the line box, adding a new keyword to |
We ended up adding a new property to switch into the desired behavior for TTML. however, the title of this issue stands: what exactly |
( EDIT: this is substantially revised in #2228 (comment)) I've been doing some work on this, with a goal of tightly define the value of "line-height: normal" and the behaviour of "inline-sizing: normal". The latter refers to CSS2 10.6.1 which recommends:
So I rolled some tests to see how the various browsers currently implement this. Current BehaviourGiven the above diagram, the three values we are defining are:
Other values that are derived from these include:
Assuming the font used is an OpenType font containing the "hhea" and "OS/2" tables (in 2018, that's pretty much all of them), then we found Firefox, Chrome and Safari all calculate the values like this:
and IE11 calculates the values as
This applies when the font is loaded from the OS, or referenced explicitly via a @font-face rule. There also appears to be an an additional test in Firefox, Chrome and Safari when "hhea.lineGap" is zero. This is the case with the default Serif font on OS X, for example, which evaluates to /System/Library/Fonts/Times.ttc on macOS 10.3 and which is how I found myself digging into this issue. It's also why I didn't test this behaviour under IE11. I've only tested with the one font so there may be more to it, but what I found was:
Possible Future DirectionIt's clear there has always been an intention to define this behaviour in CSS (see #254 and #1974). At the very least, perhaps some of this could be appended as a non-normative footnote to the spec? Or, if there was a desire to expand this property to defined the behaviour described here, then purely to get the ball rolling: given the behaviour between Safari/Chrome and Firefox differs only when the linegap is zero I would suggest modifying the inline-sizing property definition to something like:
where "linegap" or "ascent" indicate where repairs to the font-metrics are to be made; Firefox's behaviour is effectively "normal linegap" and Chrome/Safari are "normal ascent". (quick edit after posting: if something like this approach was taken, maybe consider making inline-sizing inheritable as well) |
Another quick addendum as this doesn't warrant a post on it's own - but as I was just banging on about font metrics for 100 lines, it's relevant to note that the other significant metric extracted from the font is x-height, used for the "ex" unit and middle alignment. This is extracted from "OS2.sxHeight. If it is zero, Firefox, Chrome and Safari all set it to 0.8em - not the 0.5em currently recommended in css-values-4. |
As per requirements detailed at w3c/ttml2#150 define the content area of an inline box generated by non-replaced content, particularly in the block progression direction, such that it can be predicted as a length and used in formulae for example to ensure at authoring time that the background painting areas of abutting spans on consecutive lines meet with no gaps. Although it may not be the preferred solution for defining the size of a background area, even the calculation of an appropriate padding value to achieve this presentation cannot be made currently since the size of inline box areas is undefined.
Tangentially related issue regarding line height: #254
Which spec does this issue apply to? I'm actually not sure. When I discussed this at TPAC2016 with @fantasai she told me that this is related to the Inline Layout Module ( https://www.w3.org/TR/css-inline-3/ ) however that does not seem to have any related specification text whereas the Intrinsic and Extrinsic Sizing Module seems more appropriate, specifically https://www.w3.org/TR/css-sizing-3/#max-content-block-size ; however although that defines new keywords for the
height
property that could be relevant, theheight
property itself does not apply to non-replaced content, so it may not be the right place to look.The text was updated successfully, but these errors were encountered: