UFO 字体中的字形点是如何给出的?

How are glyph points given in a UFO font?

我尝试捕捉字形 points/paths(不使用字体)。我将字形转换为 UFO.

<contour>
  <point x="281" y="646" type="qcurve"/>
  <point x="273" y="599"/>
  <point x="225" y="411"/>
  <point x="216" y="363" type="qcurve"/>
  <point x="320" y="382"/>
  <point x="426" y="445" type="qcurve"/>
  <point x="603" y="552"/>
  <point x="603" y="626" type="qcurve"/>
  <point x="603" y="676"/>
  <point x="502" y="676" type="qcurve"/>
  <point x="420" y="676"/>
</contour>

根据manualqcurve 代表从 TrueType 派生的 quadratic curves。因此,我们可以通过

从一个二次控制点计算出两个贝塞尔控制点
CP1 = QP0 + 2/3 *(QP1-QP0)
CP2 = QP2 + 2/3 *(QP1-QP2)

在这种情况下,我们应该在两点之间有一个控制点(见前四行;有两个控制点)。

我们如何将具有两个控制点的二次曲线转换为贝塞尔曲线?

不存在具有两个控制点的二次曲线。根据定义,它只有一个。然而,TryeType 有一个浓缩点表示,它删除了正好位于连续二次曲线控制点之间的曲线上的点,所以你在 UFO 文件中看到的点列表只是映射到 TrueType 自己的 "on curve" 和 "off curve" 点的定义。

正如 UFO 文档所解释的,这需要 special handling, so see the "Why do more than one consecutive off-curve points appear in glyph outline?" Whosebug post 并回答如何解释这样的序列。