Closed fantasai closed 1 year ago
If font-kerning: all
(https://github.com/w3c/csswg-drafts/issues/6723#issuecomment-1411487571) is available, it will cover most cases of text-spacing: trim-all
because palt/vpal changes the advance width of full width punctuations to half width.
So I don't think text-spacing: trim-all
is highly necessary, but it might be nice to have because:
I noticed that the 'text-spacing: trim-all'
might be useful especially for Korean text. It may resolve the problem, “the spacing of adjacent fullwidth and non-fullwidth punctuations looks not very nice” (see https://github.com/w3c/csswg-drafts/issues/6091#issuecomment-1454675193), without adding non-fullwidth handling to text-spacing.
Windows and Mac's default Korean fonts, "Malgun Gothic" and "Apple SD Gothic Neo", have narrow (proportional) width glyphs for fullwidth (East_Asian_Width=Wide) punctuations, such as "《 》". So authors treat these punctuations as proportional and add space (U+0020) for necessary spacing, e.g., between "," and "《" in the following example:
… 생전에 '영국 최고의 극작가' 지위에 올랐다. 《로미오와 줄리엣》, 《햄릿》처럼 인간 내면을 통찰한 걸작을 남겼으며, …
(from an Wikipedia Korean article)
This looks good if such fonts are used (Windows and Mac's default fonts are ok), but not very good with other fonts (e.g., with Android default fonts). The 'text-spacing: trim-all'
may be used to solve this problem.
'text-spacing: trim-all'
will be useful also for Japanese text, when authors want to use proportional punctuation (with font-kerning: all
, or font-feature-settings: 'palt'
) but available fonts may not have that feature. 'text-spacing: trim-all'
may be used as a reasonable fallback.
@xfq pointed at Ken Lunde's Unicode proposals for encoding this information using Variation Selectors: https://www.unicode.org/L2/L2017/17056-sv-western-vs-eastasian.pdf
So we could ask for this proposal to be extended to handle this problem. We might still need text-trim: all
, but at least for things like the numeric separator usage, it would be best if the information could be encoded into the text stream since that's a content distinction, not a styling one.
(Apparently some Adobe fonts already implement the proposals... Which is unfortunate because the VS1/VS2 distinction isn't consistent throughout the proposal, and otherwise it would be more straightforward and consistent to extend the pattern in the earlier table to cover stops and commas.)
I believe Ken's proposal is a workaround for plain text environments; i think we should allow authors to use CSS to fix this problem on the Web – it significantly reduces authoring and maintenance hassle (made worse because VS code points are invisible) but also provides flexibility to alter things easily for ranges of text or whole documents.
@r12a That helps for styling, but doesn't help for the contextual use of narrower punctuation e.g. in the middle of a number. It's significantly more work to style that correctly than to indicate it in the character stream.
I agree with @fantasai . But also, it's not just question of whether it's more work. It's also fundamentally a semantic difference, and relying on CSS to express it seems off.
The CSS Working Group just discussed text-spacing: trim-all
, and agreed to the following:
RESOLVED: Add trim-all value
ACTION fantasai, florian to ask i18n about distinguishing between brackets and non-brackets
Follow up with i18n filed at https://github.com/w3c/jlreq/issues/377
Basic tests introduced with https://github.com/web-platform-tests/wpt/pull/42274
See this comment from @MurakamiShinyu.
The alternative would be to ask Unicode to add half-width variants of commas and middle dots for usage within numbers? :) :( T_T