W3C home > Mailing lists > Public > public-css-archive@w3.org > February 2018

Re: [csswg-drafts] [css-pseudo] Multi-line ::first-letter

From: François REMY via GitHub <sysbot+gh@w3.org>
Date: Thu, 01 Feb 2018 21:27:25 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-362407302-1517520444-sysbot+gh@w3.org>
>> Just think of a case with width:10px; font-size:1px + ::first-letter font-size:10px (if you don't apply first-letter, you have a first-letter, but if you do, you don't; it just cannot work)
> 
> This also happens with ::first-line, e.g. you can use a big letter-spacing so that the last word does not fit and goes to the next line, where there is no letter-spacing so then it could fit in the available space in the first line. Then browsers leave it in the second line: https://jsfiddle.net/pp4euopt/

That scenario is very different. Whether a word is contained in the first line or not does not threathen the existence of the first line. There is always going to be a first line, and it might very well overflow the line width if there is no other option. I don't think we want the first-letter to be allowed to overflow the first line if it can be broken up.

While you are building the first line, you are adding things to it until you cannot add things to it. While it is possible to do the same for the first letter (like Firefox is doing), it is not possible in that scenario to guarantee that the first-letter always include a letter. In Edge and Chrome, the first-letter always include a letter, but then you cannot guarantee it will fit the first line. You cannot easily have both.

The problem is that you seem to want the first-letter to not exist if all the glyphs of the first letter cannot fit the first line, which is something you can only know once you have built the first line (which is necessarily built after you have built the first letter). 

Now, you could always restart the layout ignoring the first letter if you happen to have to break inside the first letter, but restarting the layout for that seems like a waste of time. Also, like I said, restarting the layout without the first letter styles applied would actually result in a first-letter existing so the state would be contradictory.

-- 
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2254#issuecomment-362407302 using your GitHub account
Received on Thursday, 1 February 2018 21:27:28 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:24 UTC