clreq icon indicating copy to clipboard operation
clreq copied to clipboard

Spacing between ideographs and non-fullwidth punctuation/symbols

Open xfq opened this issue 2 years ago • 12 comments

https://www.w3.org/International/clreq/#mixed_text_composition_in_horizontal_writing_mode

原则上,汉字与西文字母、数字间使用不多于四分之一个汉字宽的字距或空白。

很多时候会出现汉字与非全角符号相邻的情况,举例如下。

个人认为应该添加空白的情况:

input[type="text"]选择器将选择所有type属性为textinput元素。

(右方括号和右边的汉字的字距)

在HTML中按语言修改样式的最佳方法是使用CSS的:lang()选择器。

(冒号和括号和两边汉字的字距)

C#是微软公司发布的一种由C和C++衍生出来的面向对象的编程语言,运行于.NET Framework和.NET Core之上。

使用!important是一个坏习惯,应该尽量避免。

我们可以用@font-face来指定自定义字体。

可选链?.是一种访问嵌套对象属性的安全的方式。即使中间的属性不存在,也不会出现错误。

符号^和符号$在正则表达式中具有特殊的含义。

正则表达式中的\b表示词边界。

#+.!@?^$\等符号和汉字的字距)

42%代表百分之四十二,1‰代表千分之一,|a|=2代表a的实际值是±2

{1,2}{1,2,3}的子集。

(数学符号和汉字的字距)

另外,像*这样的脚注标记不应该和汉字之间有空白。非全角的分隔号(/)和汉字之间也不应该有空白。

文档中目前没有提到这些情况。

xfq avatar Jul 21 '23 01:07 xfq

补充一个全角符号 U+2103 ℃,它作为等宽字体的摄氏度符号,于 1993 年加入 Unicode 规范

以及 U+2109 ℉,https://codepoints.net/U+2109

在三亚15°C太冷了!(U+00B0 & U+0043) 在三亚15℃太冷了!(U+2103

  • U+00B0 & U+0043 没啥问题,西文 C 后面加空白没有歧义。
  • U+2103 我倾向于后面也加空白,在中文语境可能会有两种符号混合使用的情况。很多中文输入法都提供了 U+2103 的快捷输入。所以我认为应该与第一种情况保持一致。 image image

苹果的系统中没有处理 U+2103,请看截图第二行:

image

yisibl avatar Oct 13 '23 07:10 yisibl

在三亚15°C太冷了!(U+0020 & U+00B0

这里应该是U+00B0 & U+0043

xfq avatar Oct 17 '23 03:10 xfq

@xfq 不好意思,我打错了,已更正。

yisibl avatar Oct 17 '23 03:10 yisibl

U+2103 后面加空白不是就不能保持全部是方块字了?

hax avatar Oct 17 '23 07:10 hax

U+2103 后面加空白不是就不能保持全部是方块字了?

@hax 贺老啥意思?没看懂。

yisibl avatar Oct 17 '23 07:10 yisibl

C 字形宽度差别比较大的思源宋体中,当加了 text-autospace: normal; 后,我们可以看到 C 右侧间距大小差别非常明显,这种不协调的间距使排版缺乏对称的美感。

https://github.com/w3c/clreq/assets/2784308/177e1803-ed24-43ea-83c4-ef6d0274ddd2

yisibl avatar Oct 17 '23 10:10 yisibl

Related discussions:

  • https://www.w3.org/2023/11/17-clreq-minutes.html#t02
  • https://www.w3.org/2024/01/17-clreq-minutes.html#t01

xfq avatar Nov 21 '23 03:11 xfq

See also:

xfq avatar Nov 21 '23 05:11 xfq

This is a preliminary proposal to classify code points into three categories: the first of which requires extra spacing, the second of which does not require extra spacing, and the third of which is considered ambiguous and needs to be based on context.


Extra Spacing

East_Asian_Width=H/N/Na, except for the code points in the following two classes.

No Extra Spacing

East_Asian_Width=F/W, and:

  • U+2E3A Two-Em Dash (Chinese punctuation)
  • U+2014 Em Dash (Chinese punctuation)
  • U+00B7 Middle Dot (Chinese punctuation)
  • U+2026 Horizontal Ellipsis (Chinese punctuation)
  • U+002A Asterisk (footnote)
  • U+25CA Lozenge (footnote)
  • Script=Kana/Hang (halfwidth versions of katakana and hangul)
  • Script=Egyp? (Egyptian hieroglyphs)
  • White_Space=yes
  • General Category=Cc
  • General Category=Cs?
  • General Category=Co?

Ambiguous

East_Asian_Width=A, and:

  • U+002F Solidus (based on https://www.w3.org/2023/11/17-clreq-minutes.html#x072 )
  • General Category= Cf?

Any comment on this proposal? Is this the right direction?

xfq avatar Nov 21 '23 06:11 xfq

FWIW, there is also a proposal in Unicode related to this: v1 v2 v3

xfq avatar Dec 13 '23 09:12 xfq

Note that in Japanese, it's normal to have extra spacing before "12" but not after "%" in the phrase "あああ12%あああ". I wonder if there are similar situations in Chinese.

xfq avatar Dec 17 '23 01:12 xfq

According to our meeting yesterday, let's put the update of the clreq document on hold for now and discuss it clearly with the CSSWG first.

xfq avatar Jan 18 '24 05:01 xfq