解析赫尔希字体格式 [英] Parsing the Hershey font format
问题描述
结构基本如下:每个字符由
在列0:4中的数字1-> 4000(并非全部使用),
列5:7中的顶点数量,8列中的左手位置,9列中的右手
位置,最后是单个字符
对的顶点。所有的坐标都是相对于'R'的ASCII值给出的。
如果坐标值是R,表示笔操作。
我不明白如何解析这种格式。例如字符'3':
3 11MXVNTMRMPNOPOSPURVTVVU
顶点的数量是11.这11个顶点是什么?我会说:
MX VN TM R(笔)MP NO PO SP UR(a'R'here?)VT VV U(最后一个字符缺失?)
但是错误(最后一个坐标缺失)
你错了。 R不是笔 - R是笔(空格+ R)。顶点是:
MX VN TM RM PN PN OP OS PU RV TV VU
R不是特殊的,它只是坐标系的零点,所以RM是[0; -5]。
Hershey is a text-based vectorial font format defined here: http://paulbourke.net/dataformats/hershey/
The structure is bascially as follows: each character consists of a number 1->4000 (not all used) in column 0:4, the number of vertices in columns 5:7, the left hand position in column 8, the right hand position in column 9, and finally the vertices in single character pairs. All coordinates are given relative to the ascii value of 'R'. If the coordinate value is " R" that indicates a pen up operation.
I don't understand how to parse this format. For example for the character '3':
3 11MXVNTMRMPNOPOSPURVTVVU
the number of vertices is 11. What are those 11 vertices ? I would say:
MX VN TM R(pen up) MP NO PO SP UR(a 'R' here?) VT VV U(last char missing?)
but it is wrong (last coordinate is missing)
You've got it wrong. "R" is not a "pen up" — " R" is "pen up" (space + R). The vertices are:
MX VN TM RM PN OP OS PU RV TV VU
"R" is not special, it's just the zero of the coordinate system, so "RM" is [0; -5].
这篇关于解析赫尔希字体格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!