Re: [csswg-drafts] [css-inline] Leading control at start/end of block

The CSS Working Group just discussed `Leading Control`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> Topic: Leading Control<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/3240<br>
&lt;mstange> fantasai: On that page you see some diagrams that Jan and Niklas sent me.<br>
&lt;mstange> fantasai: The problem we have in CSS that is driving a lot of typesetting people crazy is that we have above and below for text content, and it's very difficult to line up the text with other elements.<br>
&lt;mstange> ... You basically have to figure out how much space there is and use a negative margin. This is not a very robust system for achieving alignment.<br>
&lt;mstange> ... We need the ability to strip out the top part of the line box that is above the text, so that you only have leading between the lines but not above the first or below the last line.<br>
&lt;mstange> ... You also need to be able to strip out the half leading, which comes on top of the ascent, which is some arbitrary number that the font author put in that might not have much to do with anything.<br>
&lt;mstange> ... For different writing systems you want to use different metrics here.<br>
&lt;mstange> ... We need to strip it down to one particular font metric.<br>
&lt;astearns> didn't we talk about a first-baseline-offset property at some point in the past?<br>
&lt;mstange> ... The proposal is to add two new properties, for the over and under edge.<br>
&lt;mstange> ... Which strips the size of the space down to a particular font metric.<br>
&lt;Rossen> q?<br>
&lt;mstange> ... The proposal is to have leading-trim-over/under properties which strip out the space.<br>
&lt;Rossen> ack fantasai<br>
&lt;mstange> dbaron: I'm concerned about how this works if you have multiple things in a line.<br>
&lt;mstange> ... If the goal is to have two things to line up with each other, adding properties which help you remove one of the things that cause the misalignment helps you get there, but it is not solving the problem as directly as you'd like.<br>
&lt;mstange> fantasai: We also need the ability to control the line box sizing more precisely.<br>
&lt;mstange> dbaron: What I'm thinking is that this seems more like a use case for something like line grid, or something line grid-ish.<br>
&lt;mstange> fantasai: It is not about having a grid.<br>
&lt;mstange> ... It is about having the top align with an adjacent thing, or precisely controlling padding.<br>
&lt;mstange> fantasai: If I have letters in a box with padding, the amount of space between the top of the capital letters and the top of the box, visually speaking, is not the number in my padding property.<br>
&lt;mstange> fantasai: Having a line grid will not make that go away. It makes sure that consecutive lines have a particular rhythm, but it doesn't strip out this space.<br>
&lt;mstange> fantasai: The problem in the images in this issue is that the top of the text is not lining up.<br>
&lt;mstange> dbaron: One of them is about getting two things to line up, and one of them is about getting uniform spacing around something.<br>
&lt;mstange> fantasai: The distance between the content box top edge and the text as you see it visually is not controllable by the author.<br>
&lt;astearns> (agrees with fantasai fwiw - this seems useful with or without a grid)<br>
&lt;florian> q+<br>
&lt;mstange> dauwhe: I've seen this problem in my work.<br>
&lt;mstange> fantasai: Our job is to make it so that you don't need JavaScript to do basic layout.<br>
&lt;mstange> fantasai: (Comparing to initial letter:) We do very precise alignment for initial letter. It is not about measuring the space, it is about getting the browser leave enough space.<br>
&lt;dbaron> I actually didn't finish saying what I was trying to say<br>
&lt;mstange> koji: Would like to have these metrics be accessible from both CSS layout and from an API.<br>
&lt;mstange> dbaron: What I was wondering is whether this is going to make other things that we want to do in this space harder.<br>
&lt;mstange> dbaron: Is this an independent thing that is going to be able to float on its own or does it make other things more complicated?<br>
&lt;mstange> ... It's probably ok but I'm a bit worried about it.<br>
&lt;mstange> fantasai: If your concern is about the line grid stuff, this is just about helping to set where that line grid starts.<br>
&lt;mstange> ... Line grid snaps baselines. Whatever calculation we do here is not going to affect the ability to snap things to baselines.<br>
&lt;mstange> ... And step sizing works on the margin box, so it's not going to be badly affected by this either.<br>
&lt;mstange> florian: Detail: This needs to apply to the first and last lines in the paragraph, and not just to the direct children.<br>
&lt;mstange> ... This is not a problem with the design, but should be explained.<br>
&lt;mstange> ... If you have several paragraphs, you want this to apply to the first line of the first paragraph, not to each paragraph.<br>
&lt;mstange> dbaron: So you're saying it should be a non-inherited property that applies to the element that has the first line.<br>
&lt;jensimmons> if this is helpful to anyone, I just wrote this demo to help me: https://codepen.io/jensimmons/pen/GYYpvN<br>
&lt;dbaron> s/element that has the first line/first formatted line/<br>
&lt;mstange> koji: I support it.<br>
&lt;mstange> Resolved: Add a leading trimming feature to the CSS inline spec.<br>
&lt;dbaron> Probably most people will mispronounce "leading" when they see it...<br>
&lt;astearns> they do<br>
&lt;astearns> maybe line-height-trim instead?<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3240#issuecomment-432313494 using your GitHub account

Received on Tuesday, 23 October 2018 16:11:48 UTC