Re: [csswg-drafts] [css-inline-3] Initial-letters layout can be improved (#5015)

@faceless2 Thanks for the detailed writeup. :) I think you bring up some good observations here.

I also think @zed-vector’s point, “how does that make it easier for me to write my webpage?” is important. The syntax of `initial-letters` and the way it triggers various automatic calculations, and the way that `initial-letters-align` is defined and the fact that it is inherited are decisions that were made to make it easier to write a web page.

You point out that there aren't actually two alignment points, there's one, and a shift. That's a good observation, and I think you're right we can simplify the spec by describing things that way. But both alignment points are necessary because that's how we calculate the correct size for the initial letter. The author can't calculate that size, because they don't have access to the font metrics.

You also point out the case of hanging baselines doesn't work quite as expected for non-integer size values less than the drop value. But under your model, raised caps (size values larger than the drop value) would not really work as expected either. And central baseline alignment also doesn't work as expected.

One of our goals in designing this feature is to let the author declare at a high level what they want to happen: how many lines to drop, how big, with respect to the rest of the text, they want the initial letter to be. And make the UA do all the necessary calculations.

As you point out, some of these calculations could use some fine-tuning. We could have the initial value of `initial-letters-align` key off of `dominant-baseline` and `alignment-baseline` to the extent that they provide extra information. We could adjust the way alignment is done to better handle baselines that aren't on the line-over side of the text.

But fundamentally, I don't think the API is wrong: I think it is communicating between the UA and the author at exactly the right level. We just have to do better at handling the details, particularly for non-Western scripts.

-- 
GitHub Notification of comment by fantasai
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5015#issuecomment-634952448 using your GitHub account

Received on Wednesday, 27 May 2020 21:31:01 UTC