Skip to content

[css-line-grid][css-rhythm] solve the leading adjustment problem of the line-grid #941

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
frivoal opened this issue Jan 16, 2017 · 3 comments

Comments

@frivoal
Copy link
Collaborator

frivoal commented Jan 16, 2017

Line grid has an problem, alluded to in the Leading adjustments section.

If mixed fonts are used either explicitly or through fallbacks and some of the fonts are larger that then default font on the element, or are no larger but have a different baseline position, lines will be double spaced, even if visually it looks like there is plenty of room. The same problem may occur when if <sub> or <sup> are used.

If there was an allowed margin of error by which things are allowed to stick out before causing the line box to be shifted down, we could avoid this problem, but it isn't clear what that margin should be. I think that combining line-height-step with the line grid may be a way to solve that.

Reusing the terminology I proposed in #940, the difference between the natural line box and the adjusted line box could be this margin of error.

Here are a handful of proposals about how this might work:

  1. "Independent but complementary"
  1. The short-hand approach
    Same as (1), plus make line-height-step a longhand of line-grid and redefine line-grid as
    create <line-height-step>? | match-parent

  2. The auto approach
    Same as (1), plus redefine line-grid to
    create <length>? | match-parent
    and line-height-step to auto | <length>, with line-height-step:auto getting its value from the <length> param of line-grid.

  3. The "just the line grid" approach
    redefine line-grid to
    create <length>? | match-parent
    and use the extra parameter to give some breathing room to the line box, without invoking step-sizing.

1, 2 and 3 are sort of the same, but they cascade differently (and 2&3 should be identical if the author doesn't specify the line-height-step property). It is not entirely obvious to me if the fact that (unlike line-grid) line-height-step is inherited was a useful thing or a footgun. It case it is not a useful thing, solution 4 deals with the line-grid problem without getting the potential footgun.

Yet an other alternative is to make line-height-step non inherited, in which case 2/3/4 become much more similar to eachother (i.e. identical if the author doesn't specify the line-height-step property).

@liamquin
Copy link

liamquin commented Jan 19, 2017 via email

@frivoal
Copy link
Collaborator Author

frivoal commented Jan 23, 2017

Traditionally there are three approaches to this issue. (1) leave one or more blank lines when necessary (2) allow superscripts and subscripts to intrude (and possibly overlap unreadably, depending on how smart the formatter is) (3) break the grid
[...]
So there's two values - (1) maximum protrusion allowed, and (2) what to do when it's exceeded.

Correct. As things are currently defined, if you want to break the grid, you should use line-height-step alone, and if you want to leave one or more blank lines you use line-grid + css-line-snap. line-height-step comes with a way of defining the maximum protrusion allowed, but line grid does not. I am proposing that it could gain this capability through integration with line-height-step (proposals 1 to 3 in my original comment), or failing that, that it should independently gain the ability to manually specify that maximum protrusion allowed (proposal 4).

@kojiishi
Copy link
Contributor

Can you elaborate what the problem is? I read the "Leading adjustments" section but I don't understand what cases it is talking about, and it says "details to follow".

When fonts are larger, or sup/sub are used, and its result exceeds one grid, I do want line grid to double the space. It reads to me that you want to suppress that in some cases?

@jensimmons jensimmons changed the title [css-line-grid][css-rhythm] solve the leading adjustement problem of the line-grid [css-line-grid][css-rhythm] solve the leading adjustment problem of the line-grid Jan 7, 2025
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

3 participants