torchfont

TorchFont: A PyTorch-native toolkit for modeling and processing vector fonts.

Notes

TorchFont ships cohesive building blocks—dataset wrappers, tensor pens, and preprocessing transforms—that keep glyph-centric machine learning pipelines declarative and reproducible.

Features:
  • Seamless Google Fonts integration through sparse Git checkouts.

  • fontTools-backed pens that render glyph outlines directly into PyTorch tensors.

  • Composable transform primitives for truncation, batching, and patch-based reshaping.

Examples

Assemble a dataset sourced from Google Fonts:

from torchfont.datasets import GoogleFonts

ds = GoogleFonts(root="data/google_fonts", ref="main", download=True)

References

The project README covers installation, advanced usage, and contribution guidelines in greater depth.

Modules

datasets

Dataset utilities that turn font files into model-ready glyph samples.

io

Input/output helpers for converting font outlines to tensor formats.

transforms

Transform primitives tailored to tensorized glyph sequences.