-
Notifications
You must be signed in to change notification settings - Fork 672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-text] Line-end behavior of text-spacing-trim: space-first #9736
Comments
If we do adopt the change, it would look like this: #9737 |
Whether this is a downside or not depends on personal preferences. The
is often preferred over the
because it has no extra spacing between letters, even if the line length is not so short.
This description seems to match the Major Japanese publishers uses this style and Kindle also supports this as I mentioned in #9511 (comment):
To achieve this popular ebook reader's behavior, the |
I think that corresponds to figure 78 in JLREQ. But in that case, is it not simply a preference for start-alignment over justification? If we use start alignment, the result is exactly the same. However, if we use justification, even the allow-end style doesn't guarantee no extra spacing between letters, even if the line length is an integer number of ems. Since But for people who are OK with space between letters being inserted by justification, the trim-end behavior gives more consistently flush edges. 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.
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? In #9511 (comment), talking about space-first with allow-end you said:
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. |
I understand your surprise. Once, I thought the same and wrote: But now I agree that allow-end is the better default:
See §3.8.3 Procedures for Inter-Character Spacing Reduction:
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.
There will be some downside. The trim-end behavior is less safe than the allow-end on compatibility. Although
This is displayed as the following currently:
but with the trim-end behavior, this will be:
Unbalanced. |
Interesting. The problem of trimming at the end of inline-blocks could indeed be a motivation to use the allow-end behavior, but alternatively, maybe this could be a reason to make trim-end smarter. Maybe trim-end should not trim the last character in an inline block, or maybe it should not trim the last character of an inline block if there's only one line. Editing is more annoying, because we want the layout while editing to be as close as possible to the layout while not editing, so having a condition like "don't trim the last character if the content is editable" helps while you type, but it also means that when you save, the layout may change (only a little, since it's only about the last character, but still). Maybe we can do something more subtle. However, I am not fully convinced by this argument: if the inability to know if you typed the correct full width character, or mistakenly typed a half width character, is a problem, then I'm not sure why it's a problem only at the end of the line. You'd have the same issue when typing |
The problem is not just on inline-block. It affects floating box, absolutely positioned box, etc., with auto width, that contains single line text starting and ending with fullwidth brackets. In such cases, it looks unbalanced if only the closing bracket is trimed while the opening one is spaced. So I think the allow-end behavior matches best with |
The CSS Working Group just discussed
The full IRC log of that discussion<frances> Alan: Then we have text-spacing-trim<frances> Florian: implied in this included in the resolution, what should be the line ending behavior of text-space first? Choice between force trimming and allow trimming <frances> Florian: If we always allow trimming at the end, could be a little strange about left edge and slightly moved right edge. If inline block and force trim the end, with a single line space first, trim and then inline might look weird, possibly floats <astearns> ack fantasai <frances> Florian: Special case for inline and special case for floats. Could be improved by force-trimming on the end, will be a compromise. We had resolve to change, need to be deliberate. <frances> fantasai: Awkward lack of symmetry trimming with forced trimming on any text, any positioning. If space first, allow trimming on the other side. <fantasai> s/any text/any text that's a single line/ <fantasai> s/any positioning/e.g. abspos, floats, etc./ <frances> Alan: Happy to differ, is this something that we can define and change in the future? <astearns> s/differ/defer/ <frances> fantasai: possibly shouldn't define it, already making some choice to the initial value, some tweaking that can be done, decide today what can be done. <frances> Florian: If exceptional handling for floats and inline blocks, might be cases where it is better for force-end, this is safer. <frances> Alan: The definition of space-first is to allow the style on the end side. <fantasai> https://drafts.csswg.org/css-text-4/#text-spacing-trim-property <frances> florian: An alternative would be to trim on the end side,. <frances> Alan: Have not read everything in the issue, should we do anything for the last line? <astearns> Proposed: The definition of space-first uses allow-end on the end side. <frances> Alan: did not raise it in GitHub, should we have a separate issue? <frances> Florian: Could have issues in combat, should we only do it for last line or all of the lines? <frances> Alan: Any objections? <astearns> RESOLVED: The definition of space-first uses allow-end on the end side. <bkardell_> s/combat/compat ? |
I was wondering about whether it would work to do |
Sounds an interesting idea, but it complicates the spec. There is no such Japanese text layout convention and it will be hard to be acceptable. The resolution "space-first uses allow-end" is fine. |
This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f
This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972}
This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972}
This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972}
…ogic, a=testonly Automatic update from web-platform-tests [text-spacing-trim] Implement line-end logic This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972} -- wpt-commits: 05918d61fbde7aee1ffaf7211be717eed86f6c5a wpt-pr: 43987
…ogic, a=testonly Automatic update from web-platform-tests [text-spacing-trim] Implement line-end logic This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <kojiichromium.org> Reviewed-by: Kent Tamura <tkentchromium.org> Commit-Queue: Kent Tamura <tkentchromium.org> Cr-Commit-Position: refs/heads/main{#1246972} -- wpt-commits: 05918d61fbde7aee1ffaf7211be717eed86f6c5a wpt-pr: 43987 UltraBlame original commit: 7d719f9becadf1e6df9c290629594bf433b9bb25
…ogic, a=testonly Automatic update from web-platform-tests [text-spacing-trim] Implement line-end logic This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <kojiichromium.org> Reviewed-by: Kent Tamura <tkentchromium.org> Commit-Queue: Kent Tamura <tkentchromium.org> Cr-Commit-Position: refs/heads/main{#1246972} -- wpt-commits: 05918d61fbde7aee1ffaf7211be717eed86f6c5a wpt-pr: 43987 UltraBlame original commit: 7d719f9becadf1e6df9c290629594bf433b9bb25
…ogic, a=testonly Automatic update from web-platform-tests [text-spacing-trim] Implement line-end logic This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <kojiichromium.org> Reviewed-by: Kent Tamura <tkentchromium.org> Commit-Queue: Kent Tamura <tkentchromium.org> Cr-Commit-Position: refs/heads/main{#1246972} -- wpt-commits: 05918d61fbde7aee1ffaf7211be717eed86f6c5a wpt-pr: 43987 UltraBlame original commit: 7d719f9becadf1e6df9c290629594bf433b9bb25
…ogic, a=testonly Automatic update from web-platform-tests [text-spacing-trim] Implement line-end logic This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972} -- wpt-commits: 05918d61fbde7aee1ffaf7211be717eed86f6c5a wpt-pr: 43987
fixed in 5b06862. |
This patch implements the line-end logic of `text-spacing-trim` by applying the kerning only if it would not fit, as per the resolutions at: * w3c/csswg-drafts#9521 * w3c/csswg-drafts#9736 Bug: 1463891 Change-Id: I7b5b2ae43f47ce13c6eaad55a973292e82cc264f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5191602 Auto-Submit: Koji Ishii <[email protected]> Reviewed-by: Kent Tamura <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/main@{#1246972}
This is a follow up to #9511, where we reworked the value space and initial value of the
text-spacing-trim
property to bespace-all | normal | trim-auto | trim-start | space-first | trim-all | auto
I have made all the changes that we had discussed in the spec, except one. In #9511, we resolved to adapt @MurakamiShinyu 's proposal, but in addition to the various aspect of this proposal on which we had explicit agreement, there is one aspect which barely got discussed in GitHub and not at all during the call, and which is a change from the current spec.
This issue is to determine whether we want to adopt that too, or if we want to keep that aspect of the spec unchanged.
Currently, the spec defines that
space-first
value:trim-auto
), except the first linetrim-auto
ornormal
)trim-auto
)@MurakamiShinyu 's proposal kept the two first point the same, but changed the third one to:
normal
)So, with both the current and proposed definitions, when rendered with a line length of 3em,
あいう(えお)かきく
will result in:Note that both the start and end edges are flush, as the opening and closing parentheses on the second line get trimmed, enabling them to fit in the line where they otherwise couldn't, due to their blank halves.
Also, in both cases, when rendered with a line length of 3em,
あ(いうえ)おかき
will result in:The second line is shorter than the first and third, but this is unavoidable, as nothing else could fit, regardless of whether you trim the closing parenthesis or not.
However, the difference appears if we justify the previous example. With @MurakamiShinyu 's proposal, nothing changes, but the current spec would lead to:
Note that the second line has been stretched by justification, and its end-edge aligns with the first and third. If we adopt the proposal, it would no longer do that, because the closing parenthesis on the second line would not get trimmed, since the “if it would not otherwise fit prior to justification” condition is not met, and therefore its blank right-half takes space at the end of the line.
The upside of this proposed change, is that it is less of a change from the legacy value of
space-all
, and therefore is likely to cause less compatibility issues, while still bringing some improvements overspace-all
: it does do trimming of adjacent pairs in the middle of the line (not shown in the examples above), trims the start end of non-first lines, and trims at the end of the line some of the time.The downside of this proposed change is that it is less of an improvement over the legacy value of
space-all
than what it is currently specified, as it will continue to force ragged right-edges when justifying, in some situations where it could have been avoided.Personally, I would prefer to keep the spec as it is, to get the typographically better behavior, because I am skeptical that the difference will actually matter in terms of compatibility. It seems to me that any content which could have an issue with that (which I believe to be rare already) would not be content where you'd chose to apply
space-first
and justification in the first place.The text was updated successfully, but these errors were encountered: