分页: 1 / 1

Freetype初探 - 了解TrueType Outlines 和 PostScript Outlines

发表于 : 2016年11月11日 10:03
C艹艹
Outline 即 轮廓

先参考wikipedia的两个关键词
https://en.wikipedia.org/wiki/PostScript_fonts
Technology
By using PostScript (PS) language, the glyphs are described with cubic Bézier curves
(as opposed to the quadratic curves of TrueType)

https://en.wikipedia.org/wiki/TrueType
Technical notes
The outlines of the characters (or glyphs) in TrueType fonts are made of straight line
segments and quadratic Bézier curves.
PostScript字体使用3次贝塞尔曲线和直线线段描绘字体轮廓,单条3次贝塞尔曲线有2个控制点,2个定点;
Truetype 字体使用2次贝塞尔曲线和直线线段描绘字体轮廓,二次曲线的优势是处理起来比三次曲线更快一些,
缺点是遇到繁杂的曲线的时候需要提供比三次曲线更多的坐标数据

Wikipedia图例:
220px-Circle_and_quadratic_bezier.svg.png
(11.02 KiB) 已下载 743 次
A quadratic Bézier curve segment is defined by two end points and one control point. This circle is eight contiguous segments. The squares are end points and the circles are control points.
一个二次曲线片段由1个控制点和2个定点构成,该圆形由8个连续的曲线段构成(每一段曲线与曲线之间首尾相连)。
图中黑色方框表示定点,绿色圆圈表示控制点。
(可以看到每个定点恰好位于两个控制点的中间点。cx = (x1+x2)/2, cy = (y1+y2)/2,这个后面实际应用时再讨论)


打开字体文件可以查看其属于哪一种轮廓描述类型,
系统自带的字体Consolas
Consolas.png
(9.15 KiB) 已下载 760 次
网络下载的图标字体
Iconografica.png
(13.3 KiB) 已下载 760 次