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

Chromium 123 text-spacing-trim 与标点挤压冲突 #122

Open
Alan-Liang opened this issue Apr 5, 2024 · 1 comment
Open

Chromium 123 text-spacing-trim 与标点挤压冲突 #122

Alan-Liang opened this issue Apr 5, 2024 · 1 comment

Comments

@Alan-Liang
Copy link

Chromium 123 引入并默认启用了 CJK 标点挤压。在字体支持 chws 或 halt 特性时,会自动将符合条件的标点转换为半身。因此,若显示字体 fallback 到了思源等支持 chws 或 halt 的字体,标点会被挤压两次(浏览器和 js):

image

上图使用的版本为 123.0.6312.86 (正式版本) (64 位) ,字体为 Noto Sans CJK SC。

我们目前暂时关闭了 Chromium 的标点挤压(因为很多字体还没有支持所需的 OpenType 特性):

body {
    text-spacing-trim: space-all;
}

不知道是否有更好的解决方法?

@ethantw
Copy link
Owner

ethantw commented Jul 27, 2024

@Alan-Liang 回覆晚了請見諒。

距離上次han.css的更新已經很多年了,當前版本包含著大量與現有web技術相衝突、或早已不合時宜的代碼。我目前正在緩慢地開發新版本,並預期在下個發布版中解決這些與瀏覽器新特性相衝突的問題。

話雖如此,在正式發布前也無法解決您當下的問題,如果您要在實際項目中使用han.css,可以暫時透過修改JS渲染流程來避免標點被重覆擠壓的問題。

// 原先的初始化方式:
// Han.init()

// 修改為:
const $body = document.body
const han = Han($body)

han
.initCond()
.renderElem()
.renderHanging()

// 只在瀏覽器不支援 `text-spacing-trim: normal` 特性時調用han.css提供的標點擠壓API
if (!CSS.supports('text-spacing-trim: normal')) {
  han.renderJiya()
}

han
.renderHWS()
.correctBasicBD()
.substCombLigaWithPUA()

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

No branches or pull requests

2 participants