w3c / clreq

Requirements for Chinese Text Layout
https://www.w3.org/International/clreq/
Other
722 stars 61 forks source link

Spacing between ideographs and non-fullwidth punctuation/symbols #559

Open xfq opened 1 year ago

xfq commented 1 year ago

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}的子集。

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

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

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

yisibl commented 11 months ago

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

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

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

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

image

xfq commented 11 months ago

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

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

yisibl commented 11 months ago

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

hax commented 11 months ago

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

yisibl commented 11 months ago

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

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

yisibl commented 11 months ago

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

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

xfq commented 10 months ago

Related discussions:

xfq commented 10 months ago

See also:

xfq commented 10 months ago

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:

Ambiguous

East_Asian_Width=A, and:


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

xfq commented 9 months ago

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

xfq commented 9 months ago

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 commented 8 months ago

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.