Skip to content

Conversation

@MurakamiShinyu
Copy link
Member

@MurakamiShinyu MurakamiShinyu commented Nov 10, 2021

text-spacing

Spec: CSS Text Module Level 4 / §10.2 Character Class Spacing: the text-spacing property

Name:   text-spacing
Value:  normal | none | auto | [[ trim-start | space-start | space-first ] ||
    [ trim-end | space-end | allow-end ] || [ trim-adjacent | space-adjacent ] ||
    no-compress || ideograph-alpha || ideograph-numeric || punctuation];
Initial:   normal
Inherited: yes

Limitations and differences from the current CSS draft spec

  • normal is equivalent to space-first trim-end trim-adjacent
    Note: it was space-start allow-end trim-adjacent in the draft spec
  • auto is equivalent to trim-start trim-end trim-adjacent ideograph-alpha ideograph-numeric
    Note: auto is defined in the editor's draft as
    "The user agent chooses a set of typographically high quality spacing value."
  • ideograph-alpha and ideograph-numeric create 1/6em space.
    Note: the 1/4em space in the draft is considered too wide in many cases.
  • allow-end is treated as trim-end (update: fixed in The allow-end value of text-spacing and hanging-punctuation #818)
  • no-compress and punctuation are ignored

hanging-punctuation

Spec: CSS Text Module Level 3 / §8.2.1 Hanging Punctuation: the hanging-punctuation property

Name:   hanging-punctuation
Value:  none | [ first || [ force-end | allow-end ] || last ]
Initial:   none
Inherited: yes

Limitations and differences from the current CSS draft spec

  • allow-end is treated as force-end (update: fixed in The allow-end value of text-spacing and hanging-punctuation #818)
  • Stops and commas allowed to hang are limited to U+3001, U+3002, U+FF0C, U+FF0E, U+FF61, U+FF64 [、。,.、。]
    • Not include ASCII comma and full stop, Arabic comma adn full stop, Small comma, etc. that are included in the draft spec.

Spec: CSS Text Module Level 4 / Character Class Spacing: the text-spacing property

- Working Draft: https://www.w3.org/TR/css-text-4/#text-spacing-property
- Editor' Draft: https://drafts.csswg.org/css-text-4/#text-spacing-property

```
Name:   text-spacing
Value:  normal | none | auto | [[ trim-start | space-start | space-first ] ||
    [ trim-end | space-end | allow-end ] || [ trim-adjacent | space-adjacent ] ||
    no-compress || ideograph-alpha || ideograph-numeric || punctuation];
Initial:   normal
Inherited: yes
```

**Limitations and differences from the current CSS draft spec:**

- `normal` is equivalent to `space-first trim-end trim-adjacent`
  **Note:** it was `space-start allow-end trim-adjacent` in the draft spec
- `auto` is equivalent to `trim-first trim-end trim-adjacent ideograph-alpha ideograph-numeric`
  **Note:** `auto` is defined in the editor's draft as
  "The user agent chooses a set of typographically high quality spacing value."
- `ideograph-alpha` and `ideograph-numeric` create 1/6em space.
  **Note:** the 1/4em space in the draft is considered too wide in many cases.
- `allow-end` is treated as `trim-end`
- `no-compress` and `punctuation` are ignored

Resolves #595
@vercel
Copy link

vercel bot commented Nov 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/vivliostyle/vivliostyle/6vrZMvRL6YNB3acAyMtobCRJnE2q
✅ Preview: https://vivliostyle-git-feat-text-spacing-vivliostyle.vercel.app

@MurakamiShinyu
Copy link
Member Author

MurakamiShinyu commented Nov 10, 2021

Known bugs:

Spec: CSS Text Module Level 3 / §8.2.1 Hanging Punctuation: the hanging-punctuation property

- Working Draft: https://www.w3.org/TR/css-text-3/#hanging-punctuation-property
- Editor' Draft: https://drafts.csswg.org/css-text-3/#hanging-punctuation-property

```
Name:   hanging-punctuation
Value:  none | [ first || [ force-end | allow-end ] || last ]
Initial:   none
Inherited: yes
```

**Limitations and differences from the current CSS draft spec:**

- `allow-end` is treated as `force-end`
- Stops and commas allowed to hang are limited to U+3001, U+3002, U+FF0C, U+FF0E, U+FF61, U+FF64 [、。,.、。]
  - Not include ASCII comma and full stop, Arabic comma adn full stop, Small comma, etc. that are included in the draft spec.
@MurakamiShinyu MurakamiShinyu changed the title feat: Support CSS text-spacing property Support CSS text-spacing and hanging-punctuation properties Nov 12, 2021
@MurakamiShinyu MurakamiShinyu marked this pull request as ready for review November 12, 2021 17:52
@MurakamiShinyu
Copy link
Member Author

MurakamiShinyu commented Nov 12, 2021

Using display:inline-block causes problem of text-decoration:underline broken when hanging-punctuation is enabled.
@MurakamiShinyu MurakamiShinyu merged commit 4119ad2 into master Nov 13, 2021
@MurakamiShinyu MurakamiShinyu deleted the feat/text-spacing branch November 13, 2021 09:16
MurakamiShinyu added a commit that referenced this pull request Feb 4, 2022
Tweak text-spacing and hanging-punctuation processing

This is a follow-up fix to my previous commits:

- pr #853
  - issue #820
- pr #851
  - issue #818
- pr #814
  - issue #595
MurakamiShinyu added a commit that referenced this pull request Feb 4, 2022
Tweak text-spacing and hanging-punctuation processing

This is a follow-up fix to my previous commits:

- pr #853
  - issue #820
- pr #851
  - issue #818
- pr #814
  - issue #595
MurakamiShinyu added a commit that referenced this pull request Feb 4, 2022
Improved the processing speed of text-spacing and hanging-punctuation.

This is a follow-up fix to my previous commits:

- pr #853
  - issue #820
- pr #851
  - issue #818
- pr #814
  - issue #595
@MurakamiShinyu MurakamiShinyu removed the request for review from frivoal February 15, 2022 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants