Re: [csswg-drafts] [css-text] Line-end behavior of text-spacing-trim: space-first (#9736)

> Are there cases where people want justification, and are ok with space being inserted between letters, but only if the off-grid rhythm comes from trimming at the start of the line, or from trimming adjacent punctuation, or from non CJK content, or from using a different font size on part of the line, but not if it comes from trimming punctuation at the end of the line? That seems surprising to me.

I understand your surprise. Once, I thought the same and wrote:

- https://github.com/w3c/csswg-drafts/issues/7055

But now I agree that allow-end is the better default: 

- https://github.com/w3c/csswg-drafts/issues/9521


> 
> > > This half em spacing can be removed for line adjustment (for more about line adjustment, see § 3.8 Line Adjustment).
> 
> > This description seems to match the allow-end behavior.
> 
> It's not clear to me that it does. In my reading it (and 3.8) look like they're talking of the trim-end behavior: both trim-end and allow-end do remove the half em spacing for line end adjustment. But allow-end excludes a case (line end adjustment due to justification), and I don't see any part of the text discussing that exception. Did I miss something?

See [§3.8.3 Procedures for Inter-Character Spacing Reduction](https://www.w3.org/TR/jlreq/#procedures_for_intercharacter_space_reduction):

> b. The half em spacing after closing brackets (cl-02),commas (cl-07) and full stops (cl-06) at the end of a line, is removed and set solid.

I think this processing corresponds to the allow-end behavior (not to the trim-end). Note that this "spacing reduction" processing does not occur when the half em spacing fits in the line length.  

> In [#9511 (comment)](https://github.com/w3c/csswg-drafts/issues/9511#issuecomment-1863918994), talking about space-first with allow-end you said:
> 
> > I think this setting is good enough for such Japanese contents.
> 
> I agree it is good enough: the difference is fairly small, and doesn't matter in many cases, so I will not object if that's the way we want to go. But it seems to me that the behavior with trim-end is the same if you don't want to justify, and a little bit better if you do, without any meaningful downside.

There will be some downside. The trim-end behavior is less safe than the allow-end on compatibility. Although `space-first` is no longer the default value, it is still useful to improve existing web pages just adding `body { text-spacing: space-first; }`. The same problem with #9521 happens. Also the following example:

```
<p>あああ<span style="display: inline-block">「いいい」</span>ううう</p>
```

This is displayed as the following currently:

> あああ「いいい」ううう

but with the trim-end behavior, this will be:

> あああ「いいい」ううう

Unbalanced.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 21 December 2023 10:52:08 UTC