のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

packed delta その2

staticmethod
	def compilePoints(points, numPointsInGlyph):
		# If the set consists of all points in the glyph, it gets encoded with
		# a special encoding: a single zero byte.
		if len(points) == numPointsInGlyph:
			return b"\0"

https://github.com/fonttools/fonttools/blob/master/Lib/fontTools/ttLib/tables/TupleVariation.py#L187

#セットがグリフ内のすべての点で構成されている場合は、
#特殊なエンコーディング:単一のゼロバイト。
if len(points)== numPointsInGlyph:
b "\ 0"を返す

# 'gvar'テーブルでは、ポイント番号のパックはちょっと驚きです。
#複数の実行で構成され、それぞれがデルタでエンコードされた整数のリストです。
#たとえば、ポイントセット{17,18,19,20,21,22,23}は次のようにエンコードされます。
#[6,17,1,1,1,1,1,1]。最初の値(6)は、実行長から1を引いたものです。
#実行には2種類あり、値は8または16ビットの符号なし
#整数。
ポイント=リスト(ポイント)
points.sort()
numPoints = len(ポイント)