解析 CFF 字体数据时堆栈上的额外项目
我编写了一些例程来解析 CFF 字体数据。
有时,在处理 hvcurveto
和 vvcurveto
命令时,我会在堆栈上获得额外的项目。
对于这两个命令,堆栈深度应该是
4, 5, 12, 13, 20, 21, ...
或
8, 9, 16, 17, 24, 25, ...
对于某些字体,我得到的堆栈大小为 10。由于某种原因,那里有一个额外的参数。
这是否表明我在处理之前的命令时犯了一个错误 - 或者堆栈上的额外命令对于 CFF 字体来说是常见的吗?
曲线命令位于子程序中,额外的参数似乎被传递到子程序中。
似乎只要 CFF 流中间有提示命令(而不是在开头)就有额外的参数。
I've written a few routines to parse CFF font data.
Occasionally I am getting extra items on the stack when processing an hvcurveto
and vvcurveto
command.
For these two commands the stack depth should be either
4, 5, 12, 13, 20, 21, ...
or
8, 9, 16, 17, 24, 25, ...
For some fonts I'm getting a stack size of 10. There's an extra parameter there for some reason.
Does this indicate I've made a mistake processing the previous commands - or are extra commands on the stack common for CFF fonts?
The curve commands are in a subroutine and the extra parameter seems to be passed into the subr.
It seems like the extra parameters are there whenever there are hint commands in the middle of the CFF stream instead of right at the beginning.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 CFF 规范,堆栈上不应该有额外的项目 - 开始和结束堆栈标记显然是有原因的。
事实证明,我没有正确处理提示掩码,并且这错误地在堆栈上留下了额外的参数。
As per the CFF specs there should not be extra items on the stack - the beginning and end stack markers are clearly there for a reason.
It turns out that I was not processing the hint mask correctly and this incorrectly left the extra parameter on the stack.