w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.44k stars 657 forks source link

[css-rhythm-1] Avoiding accidental double spacing #938

Open frivoal opened 7 years ago

frivoal commented 7 years ago

The spec for https://drafts.csswg.org/css-rhythm/#line-height-step says that

It is usually recommended to set the line-height lower than the step unit. The used line height can increase due to several factors such as the use of vertical-align or font fallback.

The initial value of line-height is normal which is defined like this:

normal Tells user agents to set the used value to a "reasonable" value based on the font of the element. The value has the same meaning as <number>. We recommend a used value for 'normal' between 1.0 to 1.2. The computed value is 'normal'.

Actual implementations are know to vary, and in practice the actual numerical value of line-height: normal is unpredictable. Ideally authors will not rely on it and manually set the line-height when they want to use line-height-step, but we should try to be robust when they don't.

If normal in a particular browser on a particular os with a particular font is equivalent to 1.15, and on a different browser/os/font combination, it is equal to 1.25, and an author leaves line-height at the default value, and sets line-height-step to 1.2em, things will look fine in one browser and not in the other, and the author may not know if they do not test in that particular browser/os/font combination.

I think it is quite important to reduce or eliminate this kind of situation, so we should do something.

How about this:

When line line-height-step is not 0, then line-height: normal is treated as line-height: 1 when computing the used value. This would usually be appropriate (and in the odd case where it is not, it is always possible to set a manual value), and would eliminate variation between browsers, making naïve use of line-height-step more robust.

kojiishi commented 7 years ago

This is an "error case", but a very reasonable...whatever browsers have a slightly-larger-than-normal line-height: normal value.

I assume you're talking about Latin scenario, and in that case, the "whatever browsers have line-height: normal value" is at most 1.2, so the accidental can happen only between 1 and 1.2, if I understand your definition of accidental correctly. Using the value between 1 and 1.2 is not reasonable from typographic rules, and is against the philosophy of vertical rhythm. If you're talking about other values, can you define what your accidental is?

This doesn't make sense to me. If the author is setting...

Sounds like we don't understand each other. Let's talk in Paris.

where authors are not generally aware that line-height: normal varies between browsers and even in different situations on the same browser

Ah, I found huge difference here. You might be right for Latin, I don't know, but for i18n, line-height: normal being different by browsers, fonts, and situations is a known feature, which we heavily appreciate and rely on. This might explain why we don't communicate well each other on this topic?

css-meeting-bot commented 7 years ago

The CSS Working Group just discussed inline layout.

The full IRC log of that discussion <jet> Topic: inline layout
<astearns> github: https://github.com/w3c/csswg-drafts/issues/938
<jet> Florian: from weaknesses of vertcal rythm
<jet> Florian: found lineheight issues from that investigation
<Florian> https://github.com/w3c/csswg-drafts/issues/938#issuecomment-314690847
<jet> Florian: I did a bunch of testing ^
<jet> Florian: shows how browsers differ
<jet> Florian: more interop than expected
<jet> Florian: Safari & Edge are the same
<jet> Florian: Chrome differs
<jet> Florian: Firefox differs
<jet> Florian: when lineheight is a number or length vs. normal
<jet> Florian: refers to diagram from Tokyo discussions
<jet> Florian: (see github issue for diagram)
<jet> Florian: can't figure out Chromium baseline alignment
<jet> Florian: why does chrome behave this way?
<jet> Florian: we should fork the issue for general lineheight
<jet> Florian: we need to define base behavior of lineheight
<jet> fantasai: because rhythm depends on lineheight
<fantasai> fantasai: because the trigger to round up for rhythm depends on the computation of line height
<fantasai> myles_: and you can double spacing in some UAs not others if those computations differ
<fantasai> fantasai: right
<jet> Florian: goal is general interop on lineheight
<jet> astearns: discuss divergence on lineheight:normal
<jet> Florian: can isolate individual bugs
<jet> ACTION: Florian to file bugs with each case
<trackbot> Error creating an ACTION: could not connect to Tracker. Please mail <sysreq@w3.org> with details about what happened.
<jet> fantasai: we don't have a spec for these issues
<fantasai> astearns: but we have interop except for chrome
<fantasai> astearns: so Chrome should figure out whether there's a reason to diverge, or whether they will fix it
<fantasai> astearns: and then we can spec the result of that discussion
<jet> Florian: for lineheight:normal Chrome differs by using the top of the tallest used fonts
<jet> Florian: will file a bug on that one
<jet> koji: we need to see the test
<jet> Florian: we'll debug later
<jet> Florian: I had to find fonts with tall ascenders and long descenders
<jet> Florian: Firefox font metrics differ
<jet> Florian: not sure why
<fantasai> myles_: If a browser changes the metrics they read from a font, every web page will look different. At least for us, that would be almost certainly unlikely to happen.
<jet> myles: if a browser changes metrics per font, every web page will render differently
<jet> Florian: in some cases Firefox is the same
<jet> dbaron: platform API's differ for metrics
<jet> koji: everyone has 3 font metrics
<jet> Florian: Chrome & Safari same on Mac
<jet> Florian: Chome & Edge same on WIndows
<jet> myles: some fonts are just weird
<fantasai> myles_: For at least font on at leats one platform, at least one of the metrics of the font returned by the system API doesn't appear anywhere in the font
<jet> Florian: the tests aren't clear re: metrics, but does show the divergence
<jet> Florian: I checked the content box for inlines--also no interop
<jet> Florian: on Chrome, doesnt depend on font metrics or lineheight
<jet> fantasai: spec says content box can't depend on lineheight
<jet> Florian: Firefox depends on font metrics and not lineheight
<jet> Florian: notes Chrome bugs
<jet> fantasai: is it 1 em?
<jet> fantasai: 1 em is at least predictable
<jet> Florian: not 1 em
<dbaron> FWIW, Gecko has 4 platform-specific font backends: (1) FreeType (used on Linux and Android), (2) Mac (3) GDI (Windows) and (4) DirectWrite (also Windows)
<jet> Florian: more testing needed
<jet> Bert: CSS2 recommends 1em or height of the ascender to descender
<Bert> ". The height of the content area should be based on the font, but this specification does not specify how. A UA may, e.g., use the em-box or the maximum ascender and descender of the font. "
<myles_> dbaron: macOS has CoreText and CoreGraphics and they may disagree
<Bert> (This is from CSS2)
<Bert> https://www.w3.org/TR/CSS2/visudet.html#inline-non-replaced
<dbaron> myles_, I think we're using CoreText
<jet> astearns: it differs depending on the platform font subsystem
<myles_> dbaron: 💯
<dbaron> myles_, er, wait, there's a pointer to both objects :-P
<myles_> dbaron: 💯💯✅
<jet> Florian: Firefox differs with Outlines
<dbaron> myles_, InitMetrics seems to use mostly CG* APIs
<jet> Florian: outline allows a lot of leeway
<jet> Florian: and Firefox diverges most
<jet> Florian: please review the tests
<jet> astearns: file the bugs and have the browser engineers challenge
<jet> fantasai: we want interop and sane behavior so file spec bugs not browser bugs
<jet> fantasai: resolve on content box height?
<dbaron> myles_, I think we use Core Text only for fonts with color bitmap glyphs
<fantasai> Florian: we have 3 behaviors, Chrome I can't figure out at all. Doesn't seem to depend on line height or font metrics
<fantasai> Florian: Firefox ....
<jet> astearns: if we file a Chrome bug, we can get interop
<jet> astearns: despite no spec
<jet> fantasai: we should specify what the TTML folks can use
<dbaron> I think there are probably much larger audiences than the TTML folks who care about this.
<jet> Florian: using ascender/descender lengths is unpredictable
<fantasai> dbaron, not sure who that is, but pretty sure they'd agree on having something controllable and predictable
<jet> dbaron: may be concerns re: e.g., accent marks
<jet> dbaron: and script-specific issues
<dbaron> s/accent marks/accent marks not hanging out of the background/
<dbaron> s/script-specific issues/that might be more important for Vietnamese than for English/
<jet> Florian: content box depending on font metrics is very unpredictable
<jet> Florian: we can resolve on Safari/Edge behavior re: lineheight:normal being a bug
<jet> Florian: lineheight != normal returns different sizes
<jet> astearns: curently not a spec violation
<astearns> but we should probably make it one
<jet> fremy: we can't resolve if we don't know what to spec
<dbaron> I think it is a violation of https://drafts.csswg.org/css2/visudet.html#inline-non-replaced
<jet> fremy: please file more specific issues
<jet> Florian: we'll split the topic
<astearns> dbaron: fair - "The 'height' property does not apply <to the content area>" does seem to be relevant
<jet> fantasai: file issues against CSS inline and CSS2
<jet> Florian: I tested 2 ways: line stacking and with border. same results
<dbaron> I guess it's violating the "should" that it's based on the font
<jet> fremy: spec proposes 2 solutions
<jet> fremy: not sure how we choose either
<jet> fremy: I need to check Edge code
<fremy> fremy: but maybe we consider line-height to be intent from authors they want control
<jet> Florian: interop is fixable
css-meeting-bot commented 7 years ago

The CSS Working Group just discussed CSS Rhythm.

The full IRC log of that discussion <jet> Topic: CSS Rhythm
<astearns> https://groups.google.com/forum/#!msg/mozilla.dev.platform/cnEN_sccXJY/1ddo5XifAwAJ
<fantasai> ScribeNick: fantasai
<fantasai> koji: I'd like dbaron to explain his opinion
<fantasai> dbaron: Current approaches are going to lead to things that are fragile wrt behavior between browsers, or even same browser on different platforms
<fantasai> dbaron: where you get double-spacing of line sin unpredictable situations
<fantasai> dbaron: There are alternative approaches which would not lead to this problem
<fantasai> dbaron: But I'm not interested in focusing on this right now
<fantasai> dauwhe: ?
<fantasai> dbaron: Right now not looking at anything
<fantasai> dbaron: I'm discouraging ppl from implementing this feature because I don't think it's something that should be implemented
<fantasai> dbaron: Same issue as [?]
<astearns> s/[?]/double-spacing/
<fantasai> dbaron: Some of the ways to solve it might be to use an entirely differnet design, whereas github issue is trying to keep the same design and trying to find small fixes for double-spacing
<astearns> s/dbaron: Same/koji: Same/
<fantasai> koji: Your concern is different font metrics causing different ? is the problem?
<fantasai> s/ ? / result /
<dauwhe> s/dauwhe: ?/dauwhe: are you concerned about just the inline step sizing, or all of css rhythm?
<fantasai> koji: Original issue was line-height normal causing problems
<fantasai> Florian: There's a general problem and a specific case of that problem
<fantasai> Florian: general problem is when different font metrics or different ways to implement line height or things of that nature cause the layout to work just fine in one browser
<fantasai> Florian: and to be entirely double-spaced or randomly double-spaced in another browser
<fantasai> Florian: That's the general worry
<dbaron> or different font availability
<fantasai> Florian: within that space, this github issue identifies one case where this happens
<fantasai> Florian: if this is the only case where this happens, maybe dbaron's worry goes away
<fantasai> Florian: If there are more instances of similar worries, we'll need lots of patches
<fantasai> dbaron: Another major case is font availability, where you have a font available on one platform and not on others
<fantasai> koji: I heard one example
<fantasai> koji: but dbaron's concern seems to be a different case
<fantasai> Florian: it's the same
<fantasai> Florian: if line-height-step is a user-defined specific value
<fantasai> Florian: and line-height is a different user-defined value
<fantasai> Florian: then this is generally predictable
<myles_> q+
<fantasai> Florian: if line-height is smaller than line-height-step generally okay
<fantasai> Florian: If there's one line that has a superscript and double spaced that line it's kindof okay
<fantasai> Florian: but double-spacing entire the page is a problem
<fantasai> Florian: If you set [various combinations, varous results]
<fantasai> Florian: Different fonts, different ways to read metrics from the font, different implementations of what 'line-height: normal'
<fantasai> Florian: cause differences
<myles_> q-
<fantasai> dbaron: I'm not sure that even line-height: <number> is predictable, requires testing mix of elements
<dbaron> ... where some have font fallback
<dbaron> fantasai: another case that could cause problems is different line wrapping,e.g., if superscript and subscript end up on the same line
<fantasai> Florian: Point of feature is normalization of line heights so a few lines double-spaced probably okay, but all lines not good
<fantasai> Florian: primary font doesn't have CJK and other font does, then many lines with mix of fonts
<fantasai> Florian: line-height to specific number, it's okay
<fantasai> Florian: but if you have spans in the middle of that, you might trigger problem often
<dbaron> fantasai: it's broken if the author sets something precisely expecting no gaps in the general case; they'll be upset if they see gaps
<dbaron> fantasai: you won't have a case that's extremely painful for the user
<Rossen> fantasai: it's definitely broken if the author didn't expect any gaps but there were some. If there are few gaps there shouldn't be that much of a confusion
<fantasai> astearns: author shouldn't use this if they don't want double spacing
<fantasai> jet: on dev.platform, was a question of whether authors really want this feature
<fantasai> q+
<astearns> s/don't want/can't stand occasional/
<fantasai> jet: Haven't heard demand from authors outside Koji here in this room
<fantasai> jet: Do people want that
<fantasai> Florian: People do want vertical rhythm, absolutely
<myles_> jet++
<fantasai> jet: Chromium has it behind a flag, have people been building websites with it and saying "yes I absolutely want this", haven't really seen that
<astearns> ack fantasai
<jet> fantasai: people want vertical rhythm, but is this the feature that will solve it?
<jet> fantasai: we want this spec to be robust and integrate with the rest of CSS elegantly
<jet> fantasai: I don't think this feature fits that description
<myles_> fantasai++
<tantek> fantasai++
<dauwhe> fantasai+^+^+
<fantasai> fantasai: Our goal for features we design here in the CSSWG is to be flexible, robust, poweful, easy-to-use, and understandable
<fantasai> fantasai: We intend for them to fit within, integrate with, and enhance the CSS system
<fantasai> fantasai: Not be a hacky workaround to some particular issue
<fantasai> fantasai: I don't believe this feature fits that design requirement.
<fantasai> fantasai: Additionally, I don't think it does a good job of addressing the use cases
<fantasai> fantasai: Absolutely, people want control over vertical rhythm
<fantasai> fantasai: But their problems aren't largely about lines within a long wrapped paragaph of text being slightly off-kilter
<fantasai> fantasai: The breaks in rhythm are largely introduced by block-level interjections in the flow of text
<fantasai> fantasai: Things like headings, figures, tables, and block-quotes
<fantasai> fantasai: This feature does not address these use cases
<dauwhe> q+
<fantasai> fantasai: It at best allows a hack of turning these block-level elements into inline-blocks in order to use this feature to control rhythm.
<fantasai> fantasai: I don't believe this feature is well-designed.
<Florian> q+
<fantasai> astearns: I absolutely agree that block-level interjections are also a problem, but I don't agree that they're worse than line box stepping
<dbaron> fantasai: much of the jitter in line boxes is due to...
<tantek> q?
<astearns> ack dauwhe
<fantasai> koji: I thought kobayashi-sensei explanation in Tokyo was more understood
<fantasai> koji: discussion wasn't
<fantasai> koji: what he said was what Alan said
<fantasai> koji: not sure about Latin, but for Japan
<Rossen> q+
<fantasai> koji: what he said was when block-level interjection is big enough he wants other factors wins over getting back to original rhythm
<fantasai> astearns: my impression was that his opinion was that it was acceptable but still not enough
<fantasai> koji: I talked with ppl who attended, ppl agreed with me
<fantasai> koji: maybe translation problem
<fantasai> koji: What he explained was vertical wrhythm when objects intervene
<fantasai> koji: Should be done like justification, so that each text block and image and blockquote are like characters in the "line box" of the page
<fantasai> koji: each space to have equal lenght is more important than returning to the rhythm
<fantasai> koji: line grid can do it, or maybe other features, but then have to adjust grid after intervening objects
<Rossen> q-
<fantasai> koji: but line-height-step or block-height-step doesn't have this problem
<fantasai> koji: What sensei didn't say, is making block height to step
<fantasai> dauwhe: A couple things, one is that I would love to see some East Asian examples of how this feature fixes problems of East Asian typography
<fantasai> dauwhe: examples have been in Latin, so hard for us to see the goal of this feature as designed
<fantasai> dauwhe: Also want to say that wrt Latin typesetting in general, I agree with fantasai
<fantasai> dauwhe: Last thing we want to change is line height of the blocks. This is the worst result, lowest priority. Prefer to adjust spacing around blocks
<astearns> ack Florian
<fantasai> dauwhe: So I would like to see more targeted use cases for the case of East Asian, since in Latin this is not as appropriate
<fantasai> Florian: In Latin text, you have ascenders and descenders so the visual edges of the line is irregular
<fantasai> Florian: Whereas in CJK if the spacing is irregular, it is very obvious
<Rossen> q?
<fantasai> Florian: So a small superscript that sticks out and slightly shifts the line is really bad
<fantasai> dauwhe: it's pretty bad in Latin, too
<Rossen> q+
<fantasai> Florian: So that is one part
<fantasai> Florian: Another response is to fantasai
<fantasai> Florian: wrt her design goals of CSS
<fantasai> Florian: Early incarnations of this feature were very much not robust
<fantasai> Florian: We have made changes to decrease its powerfulness to increase its robustness
<fantasai> Florian: I don't think it's robust enough yet
<fantasai> Florian: When I'm done with fixing interop on line height, then will look at robustness of this feature
<fantasai> Florian: I'm not sure we can make this feature robust enough, but either way this depends on how we fix interop of line height calculations
<fantasai> koji: We seem to be discussing two topics, one is fundamental design and the other is this problem of oduble spacing
<fantasai> Florian: The design of this feature makes it easy to use in some cases and very broken in others. If we can't fix this, we can't use this feature
<fantasai> koji: Fundamental to vetical rhythm that some authors want to take as much step as font metrics says
<fantasai> koji: if font is taller, want to take more steps, as much as needed to fit font
<fantasai> koji: whereas in some cases we consider accidental
<fantasai> koji: and that happens in line grid, too
<Rossen> q?
<fantasai> astearns: Same concern about accidental double spacing of everything is a problem both for rhythm and for line grid
<fantasai> astearns: and we can't take either of the proposals if accidental double spacing of everything is prevalent enough to be a problem
<fantasai> astearns: Accidental double spacing is prime example of the design flaw
<fantasai> astearns: still talking about double spacing
<fantasai> koji: what if double spacing happens in line grid, too?
<fantasai> myles_: I don't think anyone has made the argument that line grid should ship instead of this
<fantasai> myles_: people are simply objecting to this feature on its own merits
<astearns> ack Rossen
<fantasai> (or lack thereof)
<fantasai> Rossen: First comment about jet's comments
<fantasai> Rossen: What jet mentioned earlier about lack of examples / requests, we've had a lot of requests internally
<fantasai> Rossen: mostly ppl building multicol based layouts
<fantasai> Rossen: fairly impossible to make things align in terms of line breaks
<fantasai> Rossen: To that point, what fantasai said earlier whas right on the money
<fantasai> Rossen: Most of the problems aren't due to lines, they're mostly due to headings and other blocks that are not multiples of line height
<astearns> headings are not lines?
<fantasai> astearns, no, but I can't explain and minute...
<fantasai> :/
<astearns> (I know they're blocks)
<dbaron> Florian: his comment was looking for evidence that this particular solution addresses the use case, not evidence that the use case was important
<dbaron> s/his/jet's/
<fantasai> Rossen: I was hoping to know, it's been already 1.5-2yrs that we've been working on this
<tantek> q
<tantek> q?
<fantasai> Rossen: It's certainly the case that in CJK the use cases seem to be predominatnly based on just lines and line sof text without that much blocks or other things int he flow that contribute to irregularity
<fantasai> Rossen: in those coases perhaps line grid makes sense, maybe that's the best thing to do there
<fantasai> Rossen: at the same time, most of the objections I hear constantly against it
<tantek> q+ to ask how long has Chrome been shipping it behind a flag? and shouldn't we see at least experimental sites using that in the wild by now?
<fantasai> Rossen: are based on the other sets of requirements
<fantasai> Rossen: which are for multicol block-level stuff we were talking about
<fantasai> fantasai: No, there's two sets of objections one is the block-level concerns the other is the robustness concerns
<TabAtkins> ScribeNick: TabAtkins
<TabAtkins> fantasai: part of the robustness concerns is all this non-interop stuff for line-height in general is part of it
<TabAtkins> fantasai: Other thing is that the way we do line-height calcs in general creates jitter.
<TabAtkins> fantasai: So even if we have line boxes with same height, that doesn't the jitter case that CJK needs us to solve.
<TabAtkins> fantasai: So even without browser variance, even with a strict vertical rhythm, within the linebox the line moves, and line-height-step doesn't fix that.
<myles_> Rossen: Many of the requests that we (Microsoft) has had for this style of feature are caused by interjecting blocks in between many flowing lines of text. [myles: therefore those aren't solved by this particular solution]
<TabAtkins> fantasai: So if your concern is within a paragraph keeping a rhythm, we need to fix interop *and* maintain the baseline-to-baseline height.
<Florian> q+
<TabAtkins> fantasai: Beacuse of the way we center content in the linebox, if the content is slightly larger but doens't spill out of th elinebox, it'll center.
<fantasai> s/center/jitter/
<TabAtkins> koji: If you solve that, even when you do, if the font-size is differnet, you'll still need line-height step.
<TabAtkins> koji: So it doesn't seem to be a reason not to do line-height-step.
<TabAtkins> fantasai: The only case you need l-h-s is if, in the middle of a paragraph, you want to double-size a particular line because it includes larger content.
<fantasai> q+
<astearns> ack tantek
<Zakim> tantek, you wanted to ask how long has Chrome been shipping it behind a flag? and shouldn't we see at least experimental sites using that in the wild by now?
<dbaron> I could bring back line-box-contain with stepping extensions that I think would be more robust, at least for some values of line-box-contain.
<TabAtkins> tantek: How long has Chrome been shipping this behidn a flag?
<TabAtkins> koji: a year or so
<TabAtkins> tantek: For a feature we all agree conceptually there's demand for, we should have seen at least a handful of experimental demo sites using them.
<TabAtkins> tantek: We haven't seen that, or if we have, please provide the urls.
<TabAtkins> tantek: Second is, I'm increasingly concerned with shipping features that *almost* work, but are fragile and easily break.
<TabAtkins> tantek: Having witnessed all the float/columns confusion, having it break easily, that makes people distrust CSS as a whole.
<TabAtkins> tantek: Would be unfortunate to have the whole concept damaged as a result.
<TabAtkins> tantek: So that's why providing the block-level solutions might make it *just* dependenable enough to make it usable in production.
<TabAtkins> tantek: It won't be perfect, but can it be *reliable enough*.
<fantasai> astearns, the reason I'm saying that headings aren't lines isn't that they aren't made up of lines, of course they are. But generally the problem isn't havng each individual line snap to a multiple of the base line height, it's having the heading as a whole snap to that multiple.
<fantasai> astearns, because for headings you don't want to have large line heights or gaps between the lines
<astearns> fantasai: let's talk about this after
<TabAtkins> koji: I tried to talk to some webdevs; my feeling so far is that the experimental flag buidling sites works in US, but not in intl, where pops are smaller and people are less willing to spend effort helping standardization.
<fantasai> astearns, you usually want them quite tightly spaced, in fact, because they are a larger font size
<TabAtkins> koji: So they generally say "we'll try when it ships, but can't spend much time before that".
<fantasai> astearns, but you want space around them, and you want the total space taken up by the heading -- like the total space taken up by a figure or table or blockquote -- to fit into the rhythm
<TabAtkins> koji: For robustness, as far as I understand, your "robustness" is different from fantasai's concept.
<TabAtkins> tantek: Could be.
<TabAtkins> koji: I think you're more about accidental jumping.
<TabAtkins> koji: I think earlier we were talkinga bout, when we get the future stack thing - if it gets off the grid, it accumulates.
<TabAtkins> koji: That part is design - Japanese vertical rhythm is different from Latin's.
<astearns> ack Florian
<TabAtkins> Florian: Earlier fantasai was saying that this feature isn't quite good enough; while it solves locally the size of the line, it doesn't do the position.
<TabAtkins> Florian: Earlier feature did address that, but made it more fragile.
<TabAtkins> astearns: It solved that using the baseline ratio.
<TabAtkins> Florian: So that's a bit of the difficulty with this feature.
<TabAtkins> Florian: I haven't given up hope, but I don't know if at the end of the process it'll still be useful.
<TabAtkins> Florian: Currently kinda useful and kinda fragile; was earlier more usefula nd more fragile; will it be useful at all?
<TabAtkins> Florian: So we have a feature that's either too fragil eand not useful enough, or one that's too difficult to figure out.
<TabAtkins> Florian: Otoh, there's a simple and useful feature that solves the block side of the problem, which we most agree isn't quite enough.
<TabAtkins> Florian: But I don't think anybody thinks the block feature is insufficiently robust, or not useful.
<TabAtkins> Florian: So I recommend people start on that, rather than being stuck.
<TabAtkins> Florian: As to whether this is still useful when it's robust, dunno.
<TabAtkins> Florian: IN parallel, I think it would be nice to try and make line-grid simpler in terms of impl.
<TabAtkins> Florian: Nobody's been willing to bite the bullet yet.
<TabAtkins> Florian: If someone can find a magic solution, prizes!
<TabAtkins> fantasai: I don't think that finding the third solution is as impossible as you think.
<dbaron> q+
<TabAtkins> fantasai: First, we need to solve the jitter problem.
<TabAtkins> fantasai: We're wasting our time if we don't solve that.
<TabAtkins> fantasai: Requirement for any solution, and it's not specific to l-h-s or line-grid
<TabAtkins> fantasai: We just need to fix line layout.
<TabAtkins> fantasai: We need to continue and prioritize the work that florian has been doing, to fix line layout.
<TabAtkins> fantasai: Second, we need examples of where this specific feature is a solution to a problem.
<astearns> ack fantasai
<TabAtkins> fantasai: I think this is solving a problem of fixing line-heights within a wrapped paragraph, by doubling the spacing of that line, and I dont' think anyone wants taht in general.
<astearns> ack dbaron
<TabAtkins> dbaron: I think one thing we should look at to address this is having whatever the solution is be a bit more of a mode switch than what we're looking at.
<TabAtkins> dbaron: To some degree line-grid is such a mode switch.
<TabAtkins> dbaron: 14 years ago I had a proposal for line-box-contain, in the ED for linebox for a decade, shipping in Safari for a bit...
<TabAtkins> dbaron: That tried to add all the detail for how to consider what should affect the linebox.
<TabAtkins> dbaron: But to a good extent there's only three values that are important.
<TabAtkins> dbaron: One is what we do in quirks mode, one is what the specs say, one is what devs actually want.
<TabAtkins> dbaron: it's a little complicated, but it's in the spec, hard to find.
<TabAtkins> astearns: So in addition to box-sizing, we should have line-sizing?
<TabAtkins> dbaron: Not where I was going.
<TabAtkins> dbaron: One of the things is that you have a property that says "i want a line grid at a certain size". Whether it's a full-fledged grid or a slightly weaker thing.
<TabAtkins> dbaron: I suggest that, once that grid is established and for all the blocks that use it (presuming you can turn it off for some descendants), we switch line layout to another mode.
<TabAtkins> dbaron: WE stop stupid things, like honoring line-height on inlines.
<fantasai> dbaron+++++++++++++++++++++++++++++++++++++
<TabAtkins> myles_: +++++
<dauwhe> tell it, brother!
<TabAtkins> dbaron: Only honor line-height on boxes. Honor border or margin-box size on inlines, so if they actually overflow the line, they make it bigger.
<TabAtkins> dbaron: But if you're at line-height:1.25, you don't get the 1.25 buffer on them.
<TabAtkins> dbaron: And from there we can figure out baseline alignment to the grid.
<TabAtkins> dbaron: So I think having a non-inherited proeprty that establishes a line grid or step-sizing space, is better than an inherited mode switch, like line-box-contain was, because it serves another purpose as wlel.
<TabAtkins> dbaron: While it has some mode-switching purposes, mode-switches aren't that great. Doesn't cascade well.
<gsnedders> dbaron++++++++
<TabAtkins> dbaron: Has some of the effects of a mode switch, but not all of them.
<TabAtkins> iank_: A new inline layout...
<TabAtkins> dbaron: Not that different. Still doing inline layout.
<TabAtkins> dbaron: line-box-contain had a bunch of values that were like "block", "inline", "replaced", "text", "ruby", "glyphs"...
<TabAtkins> dbaron: When you did your linebox height calc, you looked at the list and only considered those.
<TabAtkins> dbaron: The standard behavior is "block inline repalced" i think
<Bert> https://www.w3.org/Style/Group/css3-src/css3-linebox/#LineStacking
<TabAtkins> dbaron: Quirks mode is more like "text replaced" or something
<TabAtkins> dbaron: But people don't really want inlines considered at all, you just don't want glyphs to overlap by default.
<TabAtkins> dbaron: The principle isn't complicated, it's just a new step in line layout that controls what you consider.
<TabAtkins> dbaron: The mode switch would be about changing what you consider in that step.
<TabAtkins> myles_: I think it's still in WK prefixed...
<TabAtkins> iank_: It's removed from Blink.
<TabAtkins> astearns: See if it helps enough for this use-case?
<TabAtkins> myles_: Which? ^_^
<Florian> q+
<fantasai> s/Which/Which use case/
<TabAtkins> Florian: Having discussed a variant of this for several times, I think coming back in a few months with the same discsussion isn't helpful.
<TabAtkins> Florian: I think it's clear that koji and fantasai disagree on whether robustness is important/etc.
<TabAtkins> Florian: I think it's important if koji could show sites using this feature in ways that trigger double-spacing, and say "yes, this is what the author wants".
<TabAtkins> fantasai: No, you want sites using the feature that show why this is good, and the other alternatives aren't necessary.
<TabAtkins> astearns: We want to evaluate the shipping solution, to see if it addresses the use-case.
<TabAtkins> astearns: We have a shipping solution, we should have evidence that it's enough for some set of people.
<TabAtkins> Florian: And specifically, I want to see these examples hit the conrer cases, without authors getting bad results.
<TabAtkins> astearns: Whether the extant examples hit the corners or not, we can use them to push them into the corners.
<fantasai> s/aren't necessary/can't solve it/
<TabAtkins> Florian: Other than that, I don't think it'll be useful to have elika tell koji it's not useful, and koji saying it is...
<TabAtkins> koji: I'm saying tha trobustness is different between Latin and CJK.
<TabAtkins> Florian: Sure, I'm not trying to rephrase; it's just that rehashing the same discussion without new info isn't useful.
<TabAtkins> Florian: In the meantime there are concrete things we can work on, like improving lineboxes. Maybe dbaron's stuff
<TabAtkins> Florian: In the meantime just rehashing is harmful, it blocks us from doing similar things.
<TabAtkins> tantek: I think this conversation has brought up some new stuff.
<TabAtkins> fantasai: My and dbaron's points were brought up in Tokyo.
<Bert> (A public link: https://www.w3.org/TR/2001/WD-css3-box-20010726/#the-line-box-contain )
<gregwhitworth> Decent amount of vertical rhythm libs in CSS & JS: http://kyleshevlin.github.io/shevy/
<TabAtkins> tantek: I think some new stuff, like eamples that use it
<TabAtkins> astearns: And I think line-box-contain is new.
<TabAtkins> tantek: So I think it's not fair to say it's a complete rehash.
<TabAtkins> astearns: But I agree we need examples, "this community won't turn on a flag" isn't a good enough response.
<TabAtkins> koji: Why doesn't printed material show this?
<TabAtkins> astearns: We need examples of *this particular solution* trying to solve things.
<TabAtkins> Florian: Looking at print doesn't help here; it illustrates there is a problem to solve, but not that this solution in particular solves the problem.
<TabAtkins> koji: Word isn't print - if you look at a word doc with different installed fonts, you get a similar problem.
<TabAtkins> Florian: Usually that happens because of switching between Word and OpenOffice, and people hate it.
<TabAtkins> Florian: I'm saying that showing examples of *other* things doesn't help us see if *your* solution solves stuff.
<TabAtkins> koji: If you require that of every i18n feature, we'll never get it done...
<TabAtkins> Florian: We're not asking for everything, just for controversial things.
<TabAtkins> myles_: And there's another possible solution - dbaron's l-b-c.
<TabAtkins> astearns: Even without another, this particular solution has enough controversy that we want to see successful use of it in the wild.
<myles_> I meant line-grid in addition do dbaron's idea
<TabAtkins> astearns: Anything else to go into?
<gregwhitworth> worth noting -webkit-line-grid is on chromestatus
<gregwhitworth> none of the rhythmic sizing props are
<TabAtkins> github: https://github.com/w3c/csswg-drafts/issues/938
<gregwhitworth> ^not sure if chromestatus shows experimental flag items or not
<TabAtkins> koji: Yeah. There are mutliple issues in here.
<TabAtkins> koji: ONe issue has a proposed solution, shane and tab came up with.
<TabAtkins> koji: It's about avoiding accidental jumps.
<TabAtkins> koji: I undersatand it doesn't solve all, but I want people to udnerstand the proposal and see if it solves part of the problem.
<fantasai> TabAtkins: So the ultimate problem is that when line-height is normal, it's unpredictable
<fantasai> TabAtkins: So if you set a line-height-step anywhere near the normal value, might look good on your screen not on others'
<fantasai> TabAtkins: proposal is that if lineh-height is normal and result of that would give you a light-height stlightly over your normal line-height
<fantasai> TabAtkins: based on some UA threshold of fuzziness
<fantasai> TabAtkins: Instead of doubling spacing, reduce to line-height-step
<fantasai> TabAtkins: It should hopefully correct any accidental slight overlap that you run into
<fantasai> astearns: why UA-defined squishiness
<fantasai> TabAtkins: figure out the right value later
<fantasai> TabAtkins: if we can agree on one later, great, but otherwise don't want to sink the proposal by arguing over value right now
<fantasai> Florian: I believe I understand the proposal but don't understand why it helps
<fantasai> Florian: If one browser normal is slightly smaller than step, and in toher browser slightly larger, then it helps
<fantasai> Florian: But if in your browser it's slightly larger than normal, but in other browser it's even more larger than normal
<fantasai> Florian: then you get single spacing in yours and double sizing in the other
<fantasai> Florian: So it changes the numbers that trigger the problem, but it doesn't make the problem go away
<fantasai> TabAtkins: Think set of cases that get fixed are goingto be more common than set of things that get broken
<fantasai> TabAtkins: In order tog et broken as you say, you need to set line-height-step smaller than your line-height
<fantasai> fantasai: Line height normal is unpredictable though
<fantasai> Florian: Line height: normal isnt' between 1-1.2, it comes form the font. It might be 2.7
<myles_> q+
<fantasai> Florian: within i18n contexts it varies a lot, even though you don't see it that much in Latin (aside from fantasy fonts)
<koji> q+
<fantasai> TabAtkins: Ignoring fantasy fonts and Zapfino
<astearns> ack Florian
<fantasai> fantasai: i18n
<fantasai> TabAtkins: You said there's larger variation in the consequences of the line box size due to non-Latin character set default fonts
<fantasai> Florian: I believe so, and I think Koji claimed that before I did
<astearns> ack myles_
<fantasai> fantasai: I suspect you're more likely ot get that variation in Tibetan and Thai and other fonts that have lots of diacritics
<fantasai> myles_: I agree that fuzzy matching is a good way to solve language problem
<fantasai> myles_: Implementation knows exactly where all the lines go, so implementation has all the information it needs
<fantasai> myles_: rather more than the author even, cuz author doesn't have font metrics
<fantasai> myles_: so reasonable to have implementation make lines fit well
<fantasai> myles_: previous conversation needs to be resolved before we take this though
<astearns> ack koji
<fantasai> TabAtkins: might want to evaluate solution with this in mind tho
<fantasai> koji: I agree with myles that the accidental jump issue has needs to deal with some heuristics
<fantasai> koji: because in some cases we want to squash really tall fonts
<fantasai> koji: implementation can experiment and maybe a few years later we find very good values and want to standardize it but at this point better to experiment and get feedback
<fantasai> astearns: your experimental implementation, if you can get people to use you can get data on utility of squishiness
<fantasai> koji: Does that solve previous concerns?
<fantasai> astearns: Would anyone object to objecting with this?
<fantasai> astearns: 2nd, would squishiness as described make anyone more interested in this feature?
<fantasai> myles_: not for us
<astearns> s/objecting/experimenting/
<fantasai> astearns: So this squishiness doesn't help other implementers be interested in line-height-step, but seem to be no objections to Google experimenting with it
<fantasai> Florian: No objection to experimentation, less certain about adding it to the spec
<fantasai> koji: If not in the spec, we can't ship it
<fantasai> Florian: I don't want to ship this without a flag unless we have strong evidence that it is less dangerous than people have expressed worries about
<fantasai> Florian: changes to the spec discussed so far don't make me convinced
<fantasai> koji: Why can't you at least suspect it helps?
<fantasai> Florian: I suspect it does not
<fantasai> Florian: I expect it breaks some fixes some and it's a wash
<fantasai> Florian: If it fixes lots and breaks few, pls demonstrate
<fantasai> myles_: Do we need a resolution for Chrome to experiment behind a flag?
<fantasai> Florian: No, they want it in the spec so they can ship it without a flag
<fantasai> astearns: They don't need our permission to experiment, would need permission to add it to the spec even though the consensus of the group is not that the feature is at a point that is OK to ship without a flag
<fantasai> koji: Issue was browsers hard-coded differences in line height calculations triggering different steps, we're trying to solve that, so Chrome doing it doesn't help
<fantasai> astearns: you didn't convince Florian, but myles seems to agree it might help
<fantasai> myles_: please ignore me
<myles_> s/please ignore me//
<fantasai> s/myles_: please ignore me//
<fantasai> dbaron: I agree with Florian's concern that it seems to mostly be moving the threshold and not actually fixing the bug
<fantasai> Florian: I didn't mean that in the long run Chrome should have it and others shouldn't add it, I'm suggesting that the only implementation we have experiment
<fantasai> myles_: 100% of implementations will experiment
<fantasai> Florian: Add squishiness, come back and tell us if it improves the situation
<fantasai> fantasai: Koji's pointing out that we want to find out if there's a problem with interop. Chrome can't find a problem with interop by itself
<fantasai> TabAtkins: To simulate differences in how normal gets interpreted, swap around the font list.
<fantasai> fremy: Or switch from Mac to Windows
<fantasai> astearns: OK, think we're done with rhythm
<fantasai> Meeting closed.
<gsnedders> RRSAgent: stop logging
<RRSAgent> I'm logging. I don't understand 'stop logging', gsnedders. Try /msg RRSAgent help
<gsnedders> RRSAgent: stop
kojiishi commented 6 years ago

What about discussing Line Grid first? We have WebKit implementation, so this makes us easier to look at examples.

If you open this jsbin in WebKit:

  1. The 1st box is normal flow without Line Grid. I use Arabic and Myanmar to simulate fallback to taller fonts.
  2. The 2nd box is a copy of the 1st box except it has Line Grid applied. In this box, all lines of Arabic and Myanmar consume double units.
  3. @dbaron mentioned the line-box-contain property in Paris, and fortunately WebKit implements it too, so I applied line-box-contain: block to the 3rd box.

line-grid-double-result

The 2nd box looks perfectly normal and expected result to me, except that author's choice of the rhythm isn't appropriate, but IIUC this issue thinks this result is unexpected and accidental, correct?

The 3rd box is a "fixed pitch layout", not a "vertical rhythm", unless I misunderstand how to use the line-box-contain property. I can see, however, in the 3rd box, some may consider Arabic lines are "improved" for this combination of the unit size, font metrics, and internal leadings (non-ink spaces within the font metrics) of this specific font. Is this specific case this issue is talking about?

If we want this behavior automatically, we need to rely on heuristics, as @shans and @tabatkins proposed, because there's no clear method to distinguish Arabic in this case from Myanmar. Heuristics isn't perfect, it won't work if 1px taller than the heuristic value as @frivoal pointed out in Paris, but I think that's the nature of heuristics. If that happens often, we can adjust the heuristics.

So a couple of questions:

  1. Is this Arabic case this issue is talking about?
  2. If so, do you agree this is a heuristic problem that we need to rely on heuristic solution?
kojiishi commented 6 years ago

agenda+, I'd like to confirm what this issue is about. I thought I understood but lost the confidence in Paris.

IIUC, this issue expects the 3rd (right) box for Arabic, and the 2nd (center) box for others, no?

astearns commented 6 years ago

I agree that in your example the double-spacing of the Myanmar and large capital text in the second box is largely intentional, and not relevant to this issue.

The Arabic case might be relevant. I think that if there were browser differences in dealing with how the Arabic line height interacted with a line grid such that one browser double-spaced the lines and another did not, that's the case that this issue is worried about. But it looks to me like this example should be fairly clear-cut - the Arabic line-height is several pixels larger than the grid spacing. The third box doesn't look like an improvement to me, because it's tightening the specified line-height too much to squash the lines into the grid.

So I think the example would have to be a closer call for this issue to come into play. The line-height needs to be closer to (and smaller than) the grid spacing, such that there's clear authorial intent to not get double-spaced lines. This issue is then relevant if there are enough differences in text rendering between browsers and platforms that accidental double-spacing occurs.

kojiishi commented 6 years ago

Thank you for the confirmation, that is really helpful.

I agree that in your example the double-spacing of the Myanmar and large capital text in the second box is largely intentional, and not relevant to this issue.

This is great, this is I was most worried about. Having your thoughts helped me a lot, thank you.

The Arabic case might be relevant. I think that if there were browser differences in dealing with how the Arabic line height interacted with a line grid such that one browser double-spaced the lines and another did not, that's the case that this issue is worried about.

Great again, thank you. Yeah, there will be differences by browsers/platforms, both in Line Grid and Rhythmic Sizing, because font metrics of the same font name varies by platform or even by versions of the same OS, and as we figured out, how browsers compute the height of line-height: normal vary.

What I don't understand is, how we could solve this when things are working exactly as intended by font designers but does not match to authors intention. I'm feeling we need to rely on heuristics, but I'm not confident of this part of my understanding yet.

But it looks to me like this example should be fairly clear-cut - the Arabic line-height is several pixels larger than the grid spacing. The third box doesn't look like an improvement to me, because it's tightening the specified line-height too much to squash the lines into the grid.

Great, so you think Arabic should do the 2nd box, do I understand correctly? I agree, and I was afraid people prefer the 3rd box. If a browser with the hard-coded minimum of line-height implements Line Grid, it will produce the 3rd box. Is this difference what we want to solve in this issue?

So I think the example would have to be a closer call for this issue to come into play. The line-height needs to be closer to (and smaller than) the grid spacing, such that there's clear authorial intent to not get double-spaced lines. This issue is then relevant if there are enough differences in text rendering between browsers and platforms that accidental double-spacing occurs.

I don't understand this paragraph...are you suggesting to change the example?

astearns commented 6 years ago

I am suggesting the example needs changes. As it is, it does not seem relevant to this issue to me.

kojiishi commented 6 years ago

Google Translate helped me for the first sentence, then understood the rest. Did you write "smaller" when you want "slightly larger"? If the used line-height is smaller than grid, there will be no double spacing.

To adjust the used line-height in details, I need to look into font metrics value in the debugger, but I don't have WebKit build right now. I'll try to get one, but it looks like my understanding of the problem is correct. My next question is do people agree this is a heuristic problem, but let's discuss in the call.

css-meeting-bot commented 6 years ago

The Working Group just discussed Avoiding accidental double spacing.

The full IRC log of that discussion <dael> Topic: Avoiding accidental double spacing
<tantek> is it just a button? I thought this was the first draft on the new system?
<dael> github: https://github.com/w3c/csswg-drafts/issues/938
<tantek> thanks astearns, noting here FTR: https://drafts.csswg.org/css-multicol/#changes
<koji> https://github.com/w3c/csswg-drafts/issues/938#issuecomment-330561882
<dael> koji: The biggest problem for me isI'm failing to understand definition. I made this example ^
<dael> koji: astearns gave me feedback that...the left most in the e xample is normal. Second I applied line-grid. I applied line-box contain to third.
<dael> koji: Second block has some double spacing but astearns says they're all intentional. Is that common understanding within this group?
<dael> myles: I think you're asking me?
<dael> florian: Everyone.
<dael> koji: Yeah. We need to distinguish intentional and accidental double spacing and there isn't a clear definition.
<dael> koji: The second box is [missed] it happens accidental when font metric is only slightly larger. is that correct?
<dael> astearns: one thing I missed when I commented is that in your example you are not chaning line height. it's all the same, but there are some fallback fonts making some lines taller.
<dael> koji: Correct. it started with line-height normal and it does double step.
<dael> astearns: Right. With that new understanding I believe you are correct that this is an example of the problem stated by the issue. 2nd is accidental line spacing because the author had line height normal and the grid set to something without double spacing.
<rachelandrew> someone will need to point me to how to publish the WD, me being a newbie.
<dael> astearns: IN my mind this is an intentional result of the feature. You use rhythm to get consistant spacing, but the content is such that you don't get it, so the spacing is forced by the grid so the result is what authors should expect.
<dael> koji: Okay.
<dael> koji: Are you saying this is intentional or acicdedntal?
<dael> astearns: Accidental in that if the author didn't know what content would go into their grid, they didn't have control over the fonts used, the person settin gup line grid might not have expected it. But they chose a rhythm, chose a grid, so we're fitting author intent of using a grid.
<dael> astearns: I think this is an example o f the issue as stated. I personally don't think the issue is terrifically important because author said they wanted to use a grid or rhythm.
<dael> koji: Thank you, that is exactly my understanding. florian do you have different opinion?
<dael> florian: I'm struggling with how to say my opinion in 10 minutes when in last F2F we tried to discuss and didn't conclude in 2 horus.
<dael> florian: I think when you have a case of line-height normal and then step to a value and large fallback the feature works as intended. Similar case, technically, is line-height: normal line-height-step to a specific value, and the main font on the engine happens to be a little too big and everything is double spaced. That' snot what authros want and I don't know how to fix that.
<dael> florian: First problem happens with line-grid but the second one you don't have the same problem becuase line-grid falls out of main font size.
<dael> koji: but if you go to single grid in that case lines overlap. Grid is fixed height, line-height is normal, and main font is lager.
<dael> florian: Line-grid you don't set it. That's the point.
<dael> koji: what you're saying is line unit is fixed size and line-height: normal and the primary font is taller then spec. unit. Is that the case?
<dael> florian: I think yes, I didn't hear you clearly.
<dael> koji: If you compress the font to a single unit they overlap. You said the font is taller then the unit, right?
<dael> florian: What unit?/
<dael> koji: Let me confirm. You said unit is fixed size.
<dael> florian: I said line-step-height is fixed, line-height is normal. That font on that system gives a line-height taller then step you set for primmary font.
<dael> koji: If the font is taller and you try and fit in a single step you overlap, right?
<dael> florian: Line-height is normal. They're larger then your step so you double space everything.
<dael> koji: Yousaid that's a problem?
<dael> florian: Yes.
<dael> florian: Double space everything is a problem if the rhythm works in general and some fallback is taller that's working as intended. If everything is double spaced that's not working as intended.
<dael> florian: Primary font...I can't do this in 5 minutes.
<fantasai> florian: I tried for hours and failed.
<dael> koji: [missed] We mostly discussed which features people break and htat's not related.
<dael> Rossen_: For the sake of furthering this, I think in summary I've heard that florian's main objection is in case of fallback font being slightly lrge then primary you will have double spacing when fallback font is used.
<dael> florian: That is how it works and ingeneral not a problem.
<dael> Rossen_: And because of this you expect everything will have double spacing?
<dael> florian: No, what I'm saying is when the autho sets a value for line-step-height they don't know what the result of line height calculation will be so they cannot set it in a reliable way. So there is a possibility that things will look right on one browser and not in the other because different font metrics. That's not what hte author wants and a limmitation. The double space everywhere on every brwoser is what's wanted.
<dael> koji: I think I understand your point much better. I'll prepare another test to see if my understanding is correct.
<dael> Rossen_: Sounds great. How about we try and wrap here. Seems like there's more clarity for koji in test cases you need to look at. Why don't you create the test cases and bring them back.
<dael> Rossen_: We'll take time during F2F on this, but if we can resolve before even better.
<dael> Rossen_: Okay for both of you?
<dael> koji: Okay for me.
<dael> florian: I have no obj to koji trying things out. I don't think it'll change what I think of this feature.
<dael> Rossen_: That's the top of the hour. Have a great day/night and we'll talk next week.
<tantek> next week is different time right?
astearns commented 6 years ago

I agree with the point Florian made in the minutes above. The problematic case isn't one where there are some fallback fonts that cause things to be double-spaced. The real problem is if there's a fallback that causes everything to be double-spaced.

The simplest example I can think of is one where you have two fonts that the author specifies - FontA and FontB. FontA is present on the developer's machine, but they know it isn't present on some other platform so they list FontB as a backup. All of their content can be rendered in FontA or FontB. Unfortunately the developer does not know that FontB has metrics that make the default line-height slightly larger.

As currently defined, with line-height-step the author has to choose a value, and they will choose one that works with FontA. If the value they choose is too small, all of their content will be double-spaced on the FontB platform.

As currently defined, with line-grid the author does not choose a value. By default the line grid will be established by the font metrics of FontA on the developer's machine, and by the font metrics of FontB on its platform (since it's the first available font). So content will not be double-spaced with line-grid in this case.

Is this a fair restatement of the issue, @frivoal?

frivoal commented 6 years ago

Is this a fair restatement of the issue?

Yes, this is excatly what I meant.

In addition, I'll also note that similar things can happen even if the author only specifies "FontA", in several different scenario:

kojiishi commented 6 years ago

Thank you for your replies, it gave me a new understanding of the problem.

Is this issue suggesting to add e.g., auto to compute the step unit from the used line height? If that's the case, I'm ok with it, it's just not in any use cases and no one made such requests ever.

With Line Grid, as far as I talk to web developers, they normally want different line height from grid, so their usual CSS looks like:

.line-grid {
  line-height: 1.4;
  -webkit-line-grid: create;
  -webkit-line-snap: contain;
}
.line-grid > * {
  line-height: 1.2 or normal or some other values;
}

If author uses normal to make the design i18n-friendly, here is the modified example jsbin (again for Safari to view). As you can see it, if the content uses taller fonts, there's a fallback that causes everything to be double-spaced.

2017-10-03 4 07 35

So I don't see much differences, but I understand our assumption on how authors use Line Grid is different, and if auto can save some English cases, I'm fine to add it.

frivoal commented 6 years ago

Is this issue suggesting to add e.g., auto to compute the step unit from the used line height? If that's the case, I'm ok with it.

I don't think that is what was being suggested, but I suppose it would make things better.

As I said in https://github.com/w3c/csswg-drafts/issues/938#issuecomment-292444751:

This means that if we go with an auto value, we probably needs to reuse a logic similar to the one I suggested in https://github.com/w3c/csswg-drafts/issues/938#issuecomment-292444751, where auto computes to the height of the line in px. That way, when you set something to auto, it gets the right height, but it keeps that same height when inheriting on descendants, preserving the rhythm.

So that would give us something like this: line-height-step: none | auto | <length>:

And this should come with a large warning telling authors to use auto rather than <length> to avoid interop problems.

Or maybe a slightly more expressive vairiant (based on what I suggested back then): line-height-step: none | auto | [ <length> [ safe | unsafe ]? ]

I like that a better because: 1) It is a little more expressive 2) it forces authors to type "unsafe" to get the behavior that has interop risks, and hopefully this will have enough of a deterrent effect that things will be alright.

So I don't see much differences, but I understand our assumption on how authors use Line Grid is different, and if auto can save some English cases, I'm fine to add it.

I do not think this has anything to do with English vs Japanese. The example @astearns gave in https://github.com/w3c/csswg-drafts/issues/938#issuecomment-332631897 and the ones I gave in https://github.com/w3c/csswg-drafts/issues/938#issuecomment-332999350 are equaly likely to happen in any language.

kojiishi commented 6 years ago

Great, we're getting to the consensus.

When setting the line-heigh-step, you (almost?) never want to set it to something smaller than the line height of the element that establishes the rhythm.

People wants half-rhythm. This doesn't align lines across columns, but still gives a good rhythm, and consumes less spaces, and that this is suitable for mobile scenario. For this use case, safe/unsafe doesn't express its intention very well.

none was discussed before, but fantasai didn't like having two ways to turn it off, and we can't eliminate accepting 0, so it was removed.

So, shall we start with auto | <length> and see what it happens?

Also are you ok to add <length> to Line Grid as well? This is the largest feedback I've got so far in terms of numbers.

astearns commented 6 years ago

If you're getting feedback that line grid needs a <length> somewhere, please open a separate issue so that we can discuss the use cases. I haven't been convinced it's necessary.

kojiishi commented 6 years ago

please open a separate issue so that we can discuss the use cases. I haven't been convinced it's necessary.

Ok, thanks, will do so.

kojiishi commented 6 years ago

Alan's suggestion above gave me a hint for another idea.

What do you think about

line-height-step: none | auto

?

kojiishi commented 6 years ago

agenda+

Proposals

  1. line-height-step: none | auto | [ <length> [ safe | unsafe ]? ]
  2. line-height-step: match-parent | none | auto

Background

As I understood last week, @frivoal is not trying to solve the problem itself but wants to solve by making it harder for authors. I, and IIUC @tabatkins / @shans / @dbaron as well, were all trying to solve, with heuristics or with side effects, so none sounded to him. I didn't understand his proposal because it didn't seem to solve, until I understand he's trying to solve by making harder.

Proposal 1 makes this specific case harder to appear unless author adds unsafe keyword.

Proposal 2 does so unless author adds line-height property twice, once to set to a fixed value and then to set to normal.

I prefer proposal 2, for the simplicity for authors. Also it makes compatible with Line Grid that we can discuss if/how to support <length> for both features together.

EDIT: originally, none|auto but it doesn't work, so match-parent was added.

astearns commented 6 years ago

The worry I have with going with none | auto to start, then introducing <length> later is that we still run into all the problems described above when you re-introduce <length>. Since auto is not the default it just becomes one of the options, and when the author opts into a <length> the differences between this length and the specified and used line-height all come back into play.

astearns commented 6 years ago

@koji, please do not characterize another working group member's efforts as "not trying to solve the problem." Let's continue the discussion here and come to a better understanding of both @frivoal's proposal and @dbaron's new writeup https://github.com/dbaron/css-line-spacing/blob/master/explainer.md before we come back to this on the call.

kojiishi commented 6 years ago

@astearns sorry for my vocabulary, I can't find good words to express "we would like the problem to persist if author added a unsafe keyword." That's what I understood, but great if I were wrong.

Also note that given Mozilla's feedback in Paris, Japanese companies started creating sites. I hope they can use new syntax if we were changing.

kojiishi commented 6 years ago

I guess I understood what you mean better now, better way to say it is "solve it by making it harder for authors". Sorry about that, I'll edit.

kojiishi commented 6 years ago

For your first comment, I'm thinking we can live without <length>. Hopefully that resolves your concern?

kojiishi commented 6 years ago

One more thing; @fantasai tried to solve this issue 6 years ago for Line Grid, but we chose not to solve it. Maybe we can learn from her? (disclaimer; sorry, no offence, "not to solve" is a good word in my culture but it looks like I'm wrong, haven't learned better way to express this.)

frivoal commented 6 years ago

@kojiishi, my proposal had length and unsafe and safe and all that stuff because as far as I could tell, you insisted on having length, and I was trying to make that safer without removing length. As you know say you can live without it, things get much simpler, and we don't need all that stuff anymore.

So, between the current spec and

Proposals

  1. line-height-step: none | auto | [ [ safe | unsafe ]? ]
  2. line-height-step: match-parent | none | auto

I prefer proposal 2, without much hesitation.

On the other hand, I will need a bit more time to think carefully between this vs dbaron's proposal, vs current line-grid, to understand if they are complementary proposals, or if one makes the other unneeded, and if so, which one.

fantasai commented 6 years ago

@kojiishi @frivoal While this does seem to be an improvement in addressing some of the concerns, I think it is improper for us to move forward with this feature without any sort of concrete, realistic use case to justify it and to ensure that our design is fullfilling it. I believe @kojiishi had an outstanding action item to provide some, and I think I'd prefer to have those use cases to discuss first so that we actually understand what we're trying to solve before we decide how we want to solve it.

kojiishi commented 6 years ago

@fantasai can you open a new issue, or request discussion by e-mail? It's a great feedback, but not related with this issue.

It's a great feedback that it means the Tokyo session was a failure -- it was one of the biggest objectives to get understanding. I think this is hard because both sides discuss based on their common sense, but the common sense is different, and neither side understand how. I'm getting better understanding how Latin vertical rhythm is different, so I think I can do that better next time.

kojiishi commented 6 years ago

Another idea from a Japanese feedback is similar to Shane's heuristic idea, but apply the heuristics to the rhythm unit rather than line height. This makes sense to me, because as it was pointed out in earlier comments in this issue, this happens when the rhythm unit is between 1.0 and 1.2. When above 1.2 and if double spacing occurs, it's very likely to be intentional than accidental.

I'll try to summarize proposals so far.

kojiishi commented 6 years ago

Summary of proposals so far:

  1. Make it harder for authors 1.1. line-height-step: none | auto | [ [ safe | unsafe ]? ] (@frivoal) 1.2. line-height-step: match-parent | none | auto
  2. Heuristic 2.1. Adjust slightly larger normal height to the unit (@shans @tabatkins, @fantasai's effort looks similar to this) 2.2. Adjust rhythm unit between 1.0 and 1.2 to 1.2
  3. Non-heuristic 3.1. Item 4 of Better spacing of lines in CSS, an explainer (@dbaron) 3.2. line-box-contain: block glyphs, similar to 3.1 but opt-in (Hyatt, 6 years ago.)

Category 1 is not needed for Line Grid, but category 2/3 are probably needed for Line Grid as well.

EDIT: Note, in the comment above, @frivoal said the original intention of this issue is about making it harder, but it looks like Alan and dbaron's proposal extended the coverage of this issue, so this summary includes both. I'm open to discuss these two together, or separately.

kojiishi commented 4 years ago

I'd like to check what our current thinking about this issue.

Blink doesn't implement this in LayoutNG, and that all tests are failing in all browsers. If we're clear about what we want here, I'd like to remove the wpt tests to reduce the number of test failures.

Proposal A: Avoid accidental double spacing at all costs

Define that accidental double spacing is a blocker, and should be avoided at all costs.

Technically speaking, accidental double spacing is not avoidable for any kind of vertical rhythms. Taking this policy means that CSS will not support any kind of vertical rhythms. We can then take actions:

  1. Remove all relevant wpt tests. They're just noises today.
  2. Remove the Rhythmic Sizing spec and the Line Grid spec, or put a big warning saying "don't implement until WG changes the policy".

Proposal B: Allow UA heuristic to mitigate accidental double spacing

Define that accidental double spacing is not avoidable and we accept that it may happen in some cases, but allow UAs to add heuristics to mitigate the problem.

IIRC @fantasai raised the concern on Line Grid 7-8 years ago. We discussed and WebKit shipped without heuristics built-in, assuming it can be added if the problem arises.

Proposal C: Accept and should mitigate accidental double spacing, but don't know how yet

The similar policy as the Proposal B; we accept accidental double spacing may happen in some cases, and want to mitigate it, but prefer other methods than heuristics.

I don't know if there were any other methods, so this means that we keep this issue pending, until someone can come up with new ideas.

If we take this option, it is likely to take long until we resolve this issue. I prefer removing wpt tests until then but not strong if anyone think otherwise.

fantasai commented 4 years ago

@kojiishi I think I'm fine to put warning on 'line-height-step' feature and the Line Grid module entirely and remove the tests from the WPT system (as long as we put a note somewhere that we remember where they are in case they become useful to reference in the future). I don't think the block-step feature needs such a warning, though, so I wouldn't put it on the whole css-rhythm spec.

css-meeting-bot commented 4 years ago

The CSS Working Group just discussed Line grid and tests.

The full IRC log of that discussion <fantasai> Topic: Line grid and tests
<TabAtkins> ScribeNick: TabAtkins
<fantasai> github: https://github.com/w3c/csswg-drafts/issues/938#issuecomment-575499518
<TabAtkins> koji: we discussed quite a bit on issues for rhythm sizing last time two years ago
<TabAtkins> koji: as far as i understand, this issue was the most blocking for the feature
<TabAtkins> koji: Since then, Blink shipped LayoutNG. I didn't reimplement this in LayoutNG yet.
<TabAtkins> koji: Currently this test fails in all browsers.
<TabAtkins> koji: I don't see a way to solve this properly
<TabAtkins> florian: We talked about multiple solution for the double-sizing. What is the test assuming?
<TabAtkins> koji: We just have tests for rhythm-sizing in general.
<TabAtkins> florian: We have a spec, and tests; you fail because you don't ipmlement. That's normal, right?
<heycam> fantasai: what are the tests for? there's block step sizing and line step sizing
<TabAtkins> fantasai: Were the tests for block step sizing, or line step sizing?
<TabAtkins> koji: line step sizing
<TabAtkins> koji: Question isn't about that, tho. I have to admit that I've got not great confidence on how I understand this accidental double-spacing issue.
<rego> are these the tests? https://wpt.fyi/results/css/css-rhythm?label=experimental&label=master&aligned
<TabAtkins> koji: But if I understand correctly, florian and astearns consider this a critical blocking issue.
<TabAtkins> koji: From my perspective, any solution can't avoid accidental double-spacing in some cases.
<astearns> q+
<TabAtkins> koji: So if we say accidental double-spacing fundamentally breaks the feature, we're basically saying CSS won't have this feature. Is that correct?
<TabAtkins> florian: Problem here is we want a vertical rhythm where the lines are the same size, and what to do when you can't have that.
<TabAtkins> florian: So either you break the rhythm and let some lines get bigger, or you double size the line to keep the rhythm.
<TabAtkins> florian: Can't avoid one or the other. What you can avoid is double-size when you don't need them to be.
<TabAtkins> florian: So if we have a mode where we double-size some of the time, making sure it doesn't happen gratuitiously, or in a brittle UA-dependent way, is the essential issue.
<TabAtkins> florian: So it's not "we can never have double sizing", it's "we have to be careful and make double-sizing happen consistently and predictably"
<tantek> rather than "that would be bad", can you state the desired fallback behavior?
<TabAtkins> hober: Isn't there a third option?
<TabAtkins> hober: Enforce the rhythm, and let the line overlap slightly.
<TabAtkins> florian: I think it's a bad one, but yes.
<TabAtkins> hober: I think some would prefer that.
<TabAtkins> florian: Circling back to koji's question, we ahve multiple specs addressing this problem.
<TabAtkins> florian: My feeling is that the most realistic part of this story is block-step-sizing; easiest and least brittle.
<fantasai> TabAtkins: Not going to break your layout if all your blocks are slightly larger in one browser than another
<fantasai> TabAtkins: but very broken if every line is double-spaced
<fantasai> faceless2: This only applies when line-height is normal?
<TabAtkins> faceless2: This only applies when line-height is normal, correct?
<TabAtkins> florian: Different concepts here. block-step-sizing ahs the problem without line-height.
<TabAtkins> florian: So they overlap to varying degrees.
<TabAtkins> fantasai: I think neither of these specs should be actively tested or implemented yet; I don't think we have great consensus on this as the correct solution yet.
<TabAtkins> fantasai: block-step-sizing doesn't have this sensitivity to inline layout or font rendering.
<TabAtkins> fantasai: So I think we could point to a wpt revision that had those tests, but I don't think we shoudl highlight failures before we have agreement on the concept at all.
<astearns> q?
<TabAtkins> fantasai: I think we need to handle font fallback in a more robust way. I think there's a lot of work to do to solve rhythmic sizing well, and a lot of that is solving inline layout problem generally.
<TabAtkins> koji: We could just set line-height and it works, tho.
<TabAtkins> fantasai: Right, but baseline-to-baseline spacing is still inconsistent.
<TabAtkins> fantasai: So because we have this discrepancy, almost all the time we trigger the double-spacing.
<TabAtkins> fantasai: So we want to clear this up, make the lines naturally rhythmic, so then when we need to *interrupt* the rhythm with something significantly different we can invoke rhythmic sizing.
<TabAtkins> koji: True for Latin, I don't think it's true for CJK.
<faceless2> q+
<TabAtkins> koji: Really just want to know if we should even be thinking about imlementing right now.
<TabAtkins> fantasai: I don't think so, no. If you remove those tests, drop a link to the last revision with them into the spec.
<TabAtkins> koji: Ok. But even block sizing has these problems too.
<TabAtkins> fantasai: I don't think so, no. rhythmic sizing *will* increase the size of blocks sometimes.
<TabAtkins> koji: We will have the same problems as text tho.
<TabAtkins> florian: How?
<TabAtkins> TabAtkins: If we have rendering differences in line heights, and the block height is based on text content, we'll have the same UA-dependent differences!
<TabAtkins> florian: If you size with lh unit, then...
<TabAtkins> florian: Really my issue is just about line-step-height. I don't think it's about block-step-height, but if you think there is, go ahead and open an issue about that.
<Rossen__> ack astearns
<TabAtkins> astearns: Elika went over a bit of my comment, but if th efeature isn't in active dev, I think it's perfectly fine to remove tests from WPT. I just approved a PR to remove all the Regions tests for this reason.
<TabAtkins> astearns: I'd prefer if there *was* active development - I don't think this issue is a blocker to doing work at all.
<TabAtkins> koji: So I hear consensus to remove the tests, and add warning to line-height-step and line-grid; block-step is fine.
<Rossen__> ack faceless2
<TabAtkins> faceless2: RealObjects have implemented this; I can't speak for how well.
<Rossen__> ack fantasai
<Rossen__> ack faceless
<TabAtkins> faceless2: AH have an implementation as well.
<TabAtkins> faceless2: We've got it too.
<TabAtkins> faceless2: I think this is all about the differences in what line-height:normal means between impls.
<Rossen__> q?
<TabAtkins> TabAtkins: I'll note that the ".tentative" substring in the filename is designed for this - tests that shouldn't be considered normative yet, but are in development.
<TabAtkins> Rossen__: So current proposal is to remove tests, add warnings to line-height-step and line-grid.
<TabAtkins> myles: What will the warning say?
<TabAtkins> florian: In line-height-step it can link to this issue.
<TabAtkins> florian: For line-grid, there are concerns, but no issue yet.
<TabAtkins> astearns: I can add the warning.
<TabAtkins> astearns: "We haven't figured everything out yet, but don't try to ipmlement blind assuming it's stable. Please give feedback if you're okay with working on bleeding edge."
<fantasai> <br>