w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.51k stars 669 forks source link

[css-pseudo-4] Allow intervening space and no-break space in ::first-letter, preceding the letter #9413

Open johannesodland opened 1 year ago

johannesodland commented 1 year ago

Summary

Can we revisit the decision from 5830 to exclude word break on either side of ::first-letter? Intervening space (U+0020) and no-break space (U+00A0) should be allowed directly before the letter.

Background

Many languages use an intervening space between the quotation mark and the first letter. A notable example is the quotation dash, which is used in several languages including Norwegian, Swedish, Danish, Bulgarian, French, Greek, and others, as well as in some modern English novels.

Example from Ulysses:

― O Miss Douce! Miss Kennedy protested. You horrid thing

In practice, many languages use regular spaces or at-best no-break spaces between the first quotation mark and the first letter, despite arguments suggesting these aren't typographically ideal. This preference could arise from established guidelines or the difficulty in typing other spaces.

(I have checked Norwegian, Swedish and Danish news outlets, and all use a regular U+0020 space)

Previous discussions

Previous discussions on this topic include:

By excluding word breaks we exclude the use of (U+0020) and no-break space (U+00A0). Consequently, ::first-letter becomes impractical for languages that use a space between quotation marks and the first letter.

Proposal

Given the widespread use of intervening spaces in various languages and the practical challenges in employing specific space characters, it is worth reconsidering the decision made in issue 5830.

The ::first-letter pseudo-element should allow for the inclusion of regular space (U+0020) and no-break space (U+00A0) directly preceding the first letter.

johannesodland commented 1 year ago

cc: @fantasai

fantasai commented 6 days ago

Sounds like a use case for text-autospace: punctuation replace. :]

johannesodland commented 5 days ago

Sounds like a use case for text-autospace: punctuation replace. :]

text-autospace sounds like a powerful tool to correct the source spaces, but I'm not quite sure if it would solve the current use case. (I would be delighted if it did).

Both space (U+0020) and no-break space (U+00A0) are excluded from the set of spaces that can intervene the punctuation and the first letter.

I don't think there's another typographic space with the correct width we can replace them with? In a variable font, the width of space and no-break space would adapt as the width of the font is adjusted. Typographic spaces like Four-Per-Em Space (U+2005) would not change?