Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xfq opened this issue Jul 21, 2023 · 12 comments
Open

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

xfq opened this issue Jul 21, 2023 · 12 comments

Comments

@xfq
Copy link
Member

xfq commented Jul 21, 2023

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
Copy link

yisibl commented Oct 13, 2023

补充一个全角符号 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

@xfq
Copy link
Member Author

xfq commented Oct 17, 2023

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

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

@yisibl
Copy link

yisibl commented Oct 17, 2023

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

@hax
Copy link
Member

hax commented Oct 17, 2023

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

@yisibl
Copy link

yisibl commented Oct 17, 2023

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

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

@yisibl
Copy link

yisibl commented Oct 17, 2023

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

2023-10-17.18-22-59.mp4

@xfq xfq changed the title 汉字与非全角符号之间的间距 Spacing between ideographs and non-fullwidth punctuation/symbols Nov 14, 2023
@xfq
Copy link
Member Author

xfq commented Nov 21, 2023

@xfq
Copy link
Member Author

xfq commented Nov 21, 2023

See also:

@xfq
Copy link
Member Author

xfq commented Nov 21, 2023

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:


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

@xfq
Copy link
Member Author

xfq commented Dec 13, 2023

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

@xfq
Copy link
Member Author

xfq commented Dec 17, 2023

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
Copy link
Member Author

xfq commented Jan 18, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants