OpenType字体解析,带来愉悦和收益(任何人都可以理解这些愚蠢的表吗?) [英] OpenType Font Parsing for Pleasure and Profit (anyone understand these stupid tables?)

查看:286
本文介绍了OpenType字体解析,带来愉悦和收益(任何人都可以理解这些愚蠢的表吗?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这主要是为了娱乐,我在四处闲逛并尝试在几种字体中找到自己的出路,并且我有几个问题,如果有人做过这种事情,我将非常感谢您的帮助.

So, this is mainly for fun, I'm poking around and trying to find my way inside a few fonts and I have a few questions I'd really appreciate some help on if anyone has done this kind of stuff.

cmap表

我正在测试的字体包含几个不同格式的cmap子表.我可以阅读它们,但是我不知道应该使用哪个. IE.选择最合适的子表的策略是什么?这甚至有意义吗?

The fonts I am testing with contain several cmap subtables of different formats. I can read them, but I don't understand which I should be using. ie. what is the strategy for choosing the most appropriate subtable? Does this even make sense?

glyf表

这真的使我的头部受伤.我要按的是在这里.查看该页面的第二张表,我有'n'个endPtsOfContours,'n'个指令和'n'个标志,但是我不清楚我是否有与轮廓相同数量的标志(我知道有多少个轮廓我有).然后,使情况变得更糟..(有趣!)我有一个xCoords数组和一个yCoords数组.这些数组的长度似乎不确定,可能包含BYTE或SHORT的数据,但我们不会告诉您哪个.

This is really making my head hurt. I'm going by what is on here. Looking at the second table on that page, I've got 'n' endPtsOfContours, 'n' instructions and 'n' flags but it is not clear to me if I have the same number of flags as contours (I know how many contours I have). Then, to make matters worse..(fun!) I have an array of xCoords and an array of yCoords. These arrays seem to be of indeterminate length and may contain data of either BYTE or SHORT but we are not going to tell you which.

好的,我想这就是指令和标志的用途,但是正如您可能会告诉我的那样,我真的不知道如何处理它们.我需要TrueType解释器来访问坐标数据吗?

Ok, I suppose this is what the instructions and flags are for but as you can probably tell I don't really know how to deal with them. Do I need a TrueType interpreter to access the coordinate data?

推荐答案

您当然是正确的.

标志位1:如果置位,则相应的x坐标为1个字节长.如果未设置,则为2个字节.

flags bit 1: If set, the corresponding x-coordinate is 1 byte long. If not set, 2 bytes.

标志位2:如果置位,则相应的y坐标长1个字节.如果未设置,则为2个字节.

flags bit 2: If set, the corresponding y-coordinate is 1 byte long. If not set, 2 bytes.

我写了一段代码,在很长一段时间前遍历TrueType表-当然是在C语言中.我想您可以将结果与TTFDump的输出进行比较(仍可从Microsoft ).

I wrote code to walk the TrueType tables a long time ago--in C of course. I suppose you can compare your results with the output of TTFDump (still available from Microsoft).

这篇关于OpenType字体解析,带来愉悦和收益(任何人都可以理解这些愚蠢的表吗?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆