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

部分 otf 字体的 advanceWidth 值读取错误,造成文字间距错乱字符堆叠 #46

Open
dancancer opened this issue Apr 27, 2021 · 2 comments

Comments

@dancancer
Copy link

部分 otf 字体的 advanceWidth 值读取错误,造成文字间距错乱字符堆叠,仅影响部分 otf 字体的非中文字符

与 opentype.js 对比排查后发现,如下部分代码逻辑中在部分 otf 字体场景下 nominalWidthX 值获取有误,导致最终对应字形的 advanceWidth 有误

cff.nominalWidthX = privateDict.nominalWidthX;

排查过程中还发现该处代码中 item.advanceWidth 值正常 glyf[i].advanceWidth 值有误,简单修改设置优先取 item.advanceWidth 是否可行?

glyf[i].advanceWidth = glyf[i].advanceWidth || item.advanceWidth || 0;

以下截图为问题具体现象,上图为完整字体中 a 字形的相关参数,下图为截取后的字体。注意对比 advanceWidth 值

@kekee000
Copy link
Owner

得研究一下,otf 相关解析是照搬 opentype.js 的,可能需要做一些修正,能帮忙给有问题的字体和字符么。

@gongpeione
Copy link

同有这个问题,请问现在这个有解法么?

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

3 participants