FontGPT v1
Font Glyph Generator
2 min readupdated
FontGPT v1 is a 176M parameter AI model that creates and continues fonts by drawing glyphs as a sequence of strokes (pen walk). The model takes characters as input and outputs vector SVG contours and raster images of letters while maintaining a consistent style from character to character. Built on a decoder-only transformer architecture with stroke tokenization via BPE (Byte Pair Encoding), it was trained on a large database of free fonts. It is useful for developers, designers, and researchers interested in font and vector graphics generation.
Key features
- 176M parameter transformer architecture supporting SwiGLU MLP and U-Net skips
- Glyph generation via pen steps on a 1/128-em grid
- Support for creating new fonts from scratch or continuing a style from initial characters
- Fast GPU performance with CPU execution support
What you can do
- Generate a new font using the generation script
- Continue an existing font style using a few provided characters
- Export results to SVG and PNG formats
- Experiment with temperature and `--prime` parameters for novel combinations
Example
pip install torch numpy pillow pyarrow pandas
python generate.py --text "H a m b u r g e f o n s t i v" --out sample
python generate.py --text "a b c" --font "NAME" --out sample
python generate.py --text "a b c" --prime BANK.hand.parquet:WRITER --out sampleRead more
DetailsBenchmarks: final test loss 1.6079 nats/token, unseen-6 135.42 nats/glyph
Training: 16 layers, width 768, 12 attention heads, NorMuon and AdamW optimizers
Data: about 30k fonts and 3.56M training glyphs from open sources










Comments