Skip to content
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-4] turning things on and off, and default values of the text-spacing property #8288

Closed
frivoal opened this issue Jan 9, 2023 · 4 comments
Labels
css-text-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@frivoal
Copy link
Collaborator

frivoal commented Jan 9, 2023

Opening a new issue to track a follow up discussion of a previous one.

In #6950 (comment), @MurakamiShinyu wrote:

The text-spacing: normal definition is now:

normal -- Specifies the baseline behavior, equivalent to space-start trim-end trim-adjacent ideograph-alpha ideograph-numeric.

I am a little confused about the "baseline behavior.

Before ideograph-alpha and ideograph-numeric were added to normal definition, the meaning was clear to me, that is, the each value included in the definition of normal is the default value, so when we specify the text-spacing property partially changed from normal we can specify just changed values and omit values that are included in the normal definition.
For example, when just text-spacing: trim-start is specified, it implies omitted normal values, trim-end and trim-adjacent. i.e., text-spacing: trim-start was equivalent to text-spacing: trim-start trim-end trim-adjacent.

However, after ideograph-alpha and ideograph-numeric were added to normal definition, it is no longer that simple. Is text-spacing: trim-start equivalent to text-spacing: trim-start trim-end trim-adjacent ideograph-alpha ideograph-numeric? That will be useful when we want to change only trim-start/space-start/space-first behavior and keep other normal behavior, but if so, how do we change just ideograph-alpha/ideograph-numeric behavior from normal?

Then I decided to interpret it as follows:

  • text-spacing: trim-start is still equivalent to text-spacing: trim-start trim-end trim-adjacent. The omitted default *-start/first, *-end, and *-adjacent are kept but ideograph-alpha and ideograph-numeric are turned off.
  • ideograph-alpha and ideograph-numeric are turned on only when these values are explicitly specified, or normal (or auto, probably) is specified.

(I implemented it in Vivliostyle.js as per this interpretation. vivliostyle/vivliostyle.js#1080)


However this spec is not very clear and not very useful.

It would be better adding a new keyword, no-interscript-space, to turn off the interscript spacing.

The ideograph-alpha || ideograph-numeric part of the value definition becomes [no-interscript-space | ideograph-alpha || ideograph-numeric] and we can specify only this part to the text-spacing property when keeping other default (normal) behavior.

He then followed up with:

Or maybe it would be better to change the ideograph-alpha || ideograph-numeric value to ideograph-alpha <number> || ideograph-numeric <number> where the <number> represents the space width as a multiple of the fullwidth advance measure. The normal definition would contain ideograph-alpha 0.125 ideograph-numeric 0.125. Examples:

  • text-spacing: ideograph-alpha 0 ideograph-numeric 0 turns off the ideograph-alpha/ideograph-numeric spacing and keeps other normal behavior.
  • text-spacing: trim-start only changes the *-start/first part of normal behavior. i.e, is equivalent to text-spacing: trim-start trim-end trim-adjacent ideograph-alpha 0.125 ideograph-numeric 0.125.
@frivoal
Copy link
Collaborator Author

frivoal commented Jan 9, 2023

I suspect we should (re)design text-spacing as if it had several longhands (and possibly add them, in a later extension). One (or 2?) are about line start and end, one about inter character spacing… So, on the short hand, if you specify a value for one of the longhands but not the others, the others go back to their initial value. Not sure we need the longhands now, but we should design so that we can have them.

One oddity of the current value spaces is that some topics have an explicit no-op value, while other are just part of the global none.

  • space-start is the no-op of trim-start and space-first
  • space-end is the no-op of trim-end and allow-end
  • space-adjacent is the no-op of trim-adjacent

but

  • ideograph-alpha and ideograph-numeric and punctuation don't have an explicit no-op
  • no-compress is the no-op operation, and the "auto" value is implied

So, the implied behavior is:

  • if you specify none of space-start, trim-start, or space-first, behave as normal, i.e. space-first
  • if you specify none of space-end, allow-end, or trim-end, behave as normal, i.e. trim-end
  • if you specify neither space-adjacent nor trim-adjacent, behave as normal, i.e. trim-adjacent

So far so good, and that would map pretty well to longhand-like behavior. But how do we group the rest?

ideograph-alpha and ideograph-numeric probably belong in the same group, and if you specify neither you should get default/normal behavior, which is both of them, not none. So we need a none-like value (which @MurakamiShinyu proposed as no-interscript-space).

I suspect punctuation is a separate group on its own. Since it is default off, we don't have to have an explicit off value, but if everything else does, maybe it should too.

Maybe same thing for no-compress, though I am less sure, it's it's kind of flipped.

This gives the following longhands (maybe exposed to authors, maybe conceptual only):

  • text-spacing-start: auto | space-start | trim-start | space-first with initial value space-first
  • text-spacing-end: auto | space-end | allow-end | trim-end with initial value trim-end
  • text-spacing-adjacent: auto | space-adjacent | trim-adjacent with initial value trim-adjacent
  • text-spacing-interscript: auto | no-interscript-space | [ideograph-alpha || ideograph-numeric] with initial value ideograph-alpha ideograph-numeric
  • text-spacing-punctionation: auto | no-punctuation | punctuation with initial value no-punctuation
  • text-spacing-compression: auto | no-compress with initial value auto

On top of that, we can have the following shorthand:

text-spacing: normal | auto | none |
              no-compress ||
              [space-start | trim-start | space-first] ||
              [space-end | allow-end | trim-end] ||
              [space-adjacent | trim-adjacent] ||
              [no-interscript-space | [ideograph-alpha || ideograph-numeric]] ||
              [no-punctuation | punctuation]

In this set up:

  • auto on text-spacing maps to auto on every longhand
  • normal on text-spacing sets each longhand to its initial value: space-first, trim-end, trim-adjacent, ideograph-alpha ideograph-numeric, no-punctuation, and auto (on text-spacing-compression)
  • none on text-spacing maps to space-start, space-end, space-adjacent, no-interscript-space, no-punctuation, and no-compress on the respective longhands
  • When some other combination of values is specified on text-spacing, those that map to a longhand property get set, and other longhands get reset to their initial value.

Possibly with some bikeshedding on the value names, I think this would be a pretty reasonable design.

@xfq xfq added i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. i18n-jlreq Japanese language enablement i18n-clreq Chinese language enablement labels Jan 16, 2023
@fantasai
Copy link
Collaborator

A few notes:

  • I think we should consider shifting no-compress over to text-justify.
  • For the various trim/space- values, I'm wondering which combinations of values are actually useful, and if there's need for them to be cascaded independently.
  • I'm also a little unsure about how punctuation should fit in.

@frivoal
Copy link
Collaborator Author

frivoal commented Jan 26, 2023

Note to anyone reading this issue who hasn't seen #4246: I suggest reading #4246 (comment), as that's effectively a continuation of the suggestion above, simplified to cover only the (most) useful combinations.

fantasai added a commit that referenced this issue Feb 21, 2023
* Remove non-useful keyword combinations #4246 #8288
* Split into longhands #4246 #7183 #8288
* Ensure off values for each thing #8288 #6950
* Add insert|replace to allow replacing incorrect space characters #318 #8263 #7183
* Make space-first the initial value #2462
* Allow hanging-punctuation to hang leading ideographic spaces #2462
* Move no-compress to text-justify #7079

See https://lists.w3.org/Archives/Public/www-style/2023Feb/0002.html
@fantasai
Copy link
Collaborator

I believe this has been fixed by the refactoring in #4246. @frivoal please close out if you agree. :)

@frivoal frivoal closed this as completed Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css-text-4 i18n-clreq Chinese language enablement i18n-jlreq Japanese language enablement i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

3 participants