Skip to content

[css-text] full-width spaces not covered in the collapsible/preserved space definition #4267

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

Closed
javifernandez opened this issue Sep 2, 2019 · 4 comments · Fixed by #4269
Closed

Comments

@javifernandez
Copy link
Contributor

According to the last draft of the CSS Text specification, this is the definition of the 'white space' term:

https://drafts.csswg.org/css-text-3/#white-space

Except where specified otherwise, White space processing in CSS affects only the document white space characters: spaces (U+0020), tabs (U+0009), and segment breaks.

First of all, I wonder what "Except where specified otherwise" actually means; in my opinion this statement makes harder to understand other dependent terms, like the ones I'm trying to clarify in this issue later.

Then, it's stated in the spec that full-width spaces, like x3000 (ideographic space), are defined as 'other space separators':

https://drafts.csswg.org/css-text-3/#other-space-separators

Besides Space (U+0020) and No-Break Space (U+00A0), Unicode [UNICODE] defines a number of additional space separator characters. In this specification all characters in the Unicode Zs category (See [UAX44]) except Space (U+0020) and No-Break Space (U+00A0) are collectively referred to as other space separators.

So at this point, I understand that every time I read "white space" in the spec it doesn't apply to full-width spaces like U+3000 (ideographic space). Is this correct ?

So then we have the definition of "collapsible space", which is specified as follow:

https://drafts.csswg.org/css-text-3/#collapse

If white-space is set to normal, nowrap, or pre-line, white space characters are considered collapsible

Since the definition above uses the term "white space", I understand that full-width spaces are excluded from that definition; hence ideographic spaces are never collapsible spaces. Is this correct ?

Then there is the statement about soft wrapping opportunities activated by the white-space property:

If white-space is set to pre, pre-wrap, or break-spaces, any sequence of spaces is treated as a sequence of non-breaking spaces. However, for pre-wrap, a soft wrap opportunity exists at the end of a sequence of spaces and/or tabs, while for break-spaces, a soft wrap opportunity exists after every space and every tab.

In the statement above, the term uses is just "space", so I assume that such term includes also the "other space separator" category; hence, there are soft wrap opportunities at the end of the sequence of ideographic spaces. Again, I wonder whether this assumption about full-width spaces is correct.

It's also interesting to consider that there may be soft wrap opportunities in the middle of a sequence of full-width spaces (considered as other space separators) if the value of the white-space is either "break-spaces" or "normal"; see your comment on issue #4180, as follows:

wrapping opportunities are allowed after every ideographic space (cf: https://www.unicode.org/reports/tr14/tr14-39.html#BA)

I guess this depends on the value of the line-break property, correct ? Is this the case of regular white spaces (eg. U+0020) so that 'white-space: normal' may allow wrap opportunities after every space ?

Finally we have the definition of 'preserved white space', which is described by the spec as follows:

https://drafts.csswg.org/css-text-3/#preserved-white-space

White space that was not removed or collapsed due to white space processing is called preserved white space.

Again, since the statement above uses the term "white space" it implies that any character in the "other space separators" group is excluded; hence, I understand that full-width spaces, like U+3000, can't be considered preserved spaces. Is this correct ?

These definitions are very important, specially for the specification of the white-space property and its different values, which most of them use the term "white space", without mentioning the 'other space separator' term. They have some implications about how to compute the intrinsic size when there are 'other space separator' characters involved. But lets first clarify the definitions above before entering on these other issues.

@frivoal
Copy link
Collaborator

frivoal commented Sep 3, 2019

Since the definition above uses the term "white space", I understand that full-width spaces are excluded from that definition; hence ideographic spaces are never collapsible spaces. Is this correct ?

Yes.

In the statement above, the term uses is just "space", so I assume that such term includes also the "other space separator" category; hence, there are soft wrap opportunities at the end of the sequence of ideographic spaces. Again, I wonder whether this assumption about full-width spaces is correct.

Ah, no. "space" generally means U+0020, not any kind of space (or also may be used in cases where the difference doesn't matter).

So in a sequence of ideographic spaces with pre-wrap, they keep their normal line breaking behavior defined in UAX14's BA class: a wrapping opportunity is allowed after each (and if due to some other character, there was a wrapping opportunity before, it is not suppressed), and they don't get merged into an unbreakable sequence.

Again, since the statement above uses the term "white space" it implies that any character in the "other space separators" group is excluded; hence, I understand that full-width spaces, like U+3000, can't be considered preserved spaces. Is this correct ?

Correct. Since U+3000 isn't (white) space, it cannot be "[any adjective] (white) space".

These definitions are very important

I agree. I'll take a look and see if I can make an editorial update to disambiguate as much as possible.

frivoal added a commit to frivoal/csswg-drafts that referenced this issue Sep 3, 2019
Linkify and use non ambiguous terminology for "white space", "spaces",
and related terminology throughout normative prose.

Closes w3c#4267
@javifernandez
Copy link
Contributor Author

Ok, thanks for the clarification of these important terms. So now, lets see if I understand correctly the implications for some other properties and values.

1- I find a bit confusing that the definition of the different values of the white-space property uses only the term "space" or "white space", which may imply that the property doesn't affect to the "other space separator" characters. However, there are explicit mentions to these group of characters in the White Space Processing Details Section (Phase II).

2- Since the "other space separators" (eg, ideographic spaces) are not preserved white spaces how these spaces affect to the intrinsic size of the box ?

In general, preserved white space is measured when calculating the intrinsic sizes (min-content size and max-content size) of text; however preserved white space that would hang when at the end of the line (i.e. that preserved by pre-wrap) is excluded.

If I understood it correctly, the statement above doesn't apply to "other space separators" at all. Is this correct ?

@frivoal
Copy link
Collaborator

frivoal commented Sep 4, 2019

  1. The definitions of the values of the white-space property are kind of a summary of what they do, the full explanation is found in section 4.1, so they're not expected to get into all the details, but it'd be better if they were not confusing. Do you have a proposed rephrasing that makes this less confusing without making it much longer?

  2. Ah, right, that sentence is a bit annoying:

    • That statement indeed does't apply to other space separators at all
    • whether other space separators that hang are counted towards intrisinc sizing or not doesn't depend on this statement, and is defined in the definition of hanging, in https://drafts.csswg.org/css-text-3/#hanging
    • For preserve white space as well, this statement isn't great, as it duplicates/contradicts the definition of hanging. It should defer to that section. I'll make a PR for that.

@javifernandez
Copy link
Contributor Author

Do you have a proposed rephrasing that makes this less confusing without making it much longer?

When I read that white-space: normal applies to "white spaces" and that term is linked to the definition of the "white space" character, I interpret that it doesn't apply to "other space separators" at all.

It seems that all these properties apply only to "white spaces" if that's not the case, maybe use the general term "space", without a link, or even "space separator" character with a link to where it's explained the difference between "white space" and "other space separators". These are just some ideas that came quickly to mi mind, but perhaps we can think a bit more about this.

frivoal added a commit to frivoal/csswg-drafts that referenced this issue Sep 10, 2019
Linkify and use non ambiguous terminology for "white space", "spaces",
and related terminology throughout normative prose.

Closes w3c#4267
frivoal added a commit that referenced this issue Sep 10, 2019
Linkify and use non ambiguous terminology for "white space", "spaces",
and related terminology throughout normative prose.

Closes #4267
frivoal added a commit that referenced this issue Sep 10, 2019
@frivoal frivoal added the Testing Unnecessary Memory aid - issue doesn't require tests label Sep 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants