CFF hflex and hflex1: second curve doesn't return to the starting y
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 88/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js
调研方向
从src/glyph/CFFGlyph.js开始,检查hflex和hflex1运算符的处理。根据 issue 中引用的 Type 2 charstring 规范确认端点规则。将受影响字形的路径命令与 fontTools 的RecordingPen针对可复现问题的 CFF OTF 文件生成的输出进行比较。当两个运算符都返回起始 y 值,且生成的路径与参考结果一致时,工作即完成。
由索引模型根据 Issue 内容生成。
描述
In src/glyph/CFFGlyph.js (still on master, and in 2.0.4), the hflex (12 34) and hflex1 (12 36) operators leave the second curve at the raised y. The Type 2 charstring spec (Adobe TN #5177) says both end at the y they started from. Every point after the flex is shifted by the flex's dy, which shows up as steps or misplaced contours when drawing the path.
hflex dx1 dx2 dy2 dx3 dx4 dx5 dx6: the second curve is (dx4, 0) (dx5, -dy2) (dx6, 0), so c5y should drop back to the start. Currently:
c5y = c4y; // should be: c5y = y;
c6y = c5y;
hflex1 dx1 dy1 dx2 dy2 dx3 dx4 dx5 dy5 dx6: dy6 is implied so the curve ends at the starting y. Currently:
c5y = c4y + stack.shift();
c6x = c5x + stack.shift();
c6y = c5y; // should be: c6y = y;
(y is still the start point here because it's only updated after c6y.)
Repro: any CFF OTF whose charstrings use hflex/hflex1. Compare font.glyphForCodePoint(cp).path.commands with fontTools' RecordingPen output for the same glyph. In one font, a glyph whose contour should close at (415, -10) ends at (415, 0) in fontkit (hflex with dy2 = 10). In another, an hflex1 glyph's last point comes out at y 147 where fontTools gives 171. With the two one-line changes above, fontkit matches fontTools.
flex (12 35) and flex1 (12 37) look correct.
- 主要语言
- JavaScript
- 星标
- 1.7k
- 派生
- 254
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 22
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
foliojs/fontkit 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
维护者通常 1 天内回复
-
Vertical phantom points have the wrong sign可能已有人在做 @lehni 于 13 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 25/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
维护者通常 1 天内回复
相似的 Issue
-
bug 🐛
难度 2/5 1-3 小时 新手友好度 78/100
comunica/comunica#1960 · 1 条评论 ·
维护者通常 1 天内回复
-
Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 76/100
getsentry/sentry-javascript#26203 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 76/100
bytedance/flowgram.ai#1235 ·
维护者通常 1 天内回复