来自 LettError 的 MutatorMath
MutatorMath
简单说,它是一个Python库,适用于多维度的分段线形插值。
尽管它是为字体数据的插值而开发的,但是它适用于任意 arithmetic object(支持四则运算的对象)。
- objects/ 子包是一些通用的计算工具
- ufo/ 子包是处理 UFO 数据的工具
- MutatorMath 没有UI,只有 math
MutatorMath支持UFO3数据格式,需要几个库的支持:
Library | Author | Branch | URL |
---|---|---|---|
Defcon | TypeSupply.com | master | https://github.com/typesupply/defcon |
FontMath | TypeSupply.com | master | https://github.com/typesupply/fontMath |
ufoLib | UnifiedFontObject.org | master | https://github.com/unified-font-object/ufoLib |
MutatorMath 术语
- designspace: 任意维数的抽象欧氏空间。
- axis: 一个维度。可以有描述性的维度名,譬如
x
、y
、width
、weight
、pop
、snap
。 - location: 一个坐标点。以字典参数给出命名维度,譬如
Location(x=10)
、Location(snap=10)
。 - split location(或 ambivalent location): 2-tuple 表示坐标,譬如
Location(weight=(50, 60))
。 - origin: 原点。
- bias: 空间位移向量,用于移动所有 masters 和 instances。
- arithmetic support:
- 提供算术行为的对象
- 支持+、-、*、/的对象
- 有
__add__
,__sub__
,__mul__
,__rmul__
,__div__
and__rdiv__
方法的对象
- master: 提供 input data 的算术对象
- neutral: 在原点的master
- instance: 特定位置计算出来的对象,和 master 具有相同的 class