torchfont.io.pensΒΆ

Conversion utilities that draw vector glyphs into tensor representations.

Examples

Capture a glyph as tensors:

pen = TensorPen(glyph_set)
glyph.draw(pen)
types, coords = pen.get_tensor()
Design Notes:

Command indices are appended with an explicit end-of-sequence token to simplify batching downstream.

Classes

TensorPen(glyph_set)

FontTools pen that records glyph outlines as PyTorch tensors.