01 / 10
GlyphGAN
- PyTorch
- Python
- DCGAN
- Typography
- Objective-C++
- Core Text
Source repository https://github.com/latentcollection/glyph-ganSource repository https://github.com/latentcollection/macOS-fontface-scraper

A GAN trained on typefaces. What it produces is not a letterform but a continuous space of them, walked through so that one design flows into the next.
A generator turns random vectors into images, and a discriminator tries to tell those from real glyphs. Trained against each other, the generator ends up with a space of letterforms that can be walked rather than sampled. The walk is the work: shapes between real typefaces that are not any of them.

The 2020 version was a collaboration with Aleksi Halttunen. I rewrote it in 2026.
The dataset
No usable set of one glyph across thousands of typefaces exists, so it has to be made, and how it is made decides what the model learns. It is one letter at a time: a single glyph gives a clean design space, while all twenty-six without conditioning average into mush.
A font collection is also far less varied than its file count. On the machine this was built on, 3,639 faces came from 654 families, seventy of them GT America. Capping the set at three faces per family, spread across the weight range, cuts it to 1,405 and removes the skew.
The dataset comes from a companion tool, fontscrape: a macOS command line tool that renders one glyph from every installed font to a greyscale PNG, with the family cap, variable font instances and a licence filter built in.


It renders by glyph ID rather than by character. A face with no glyph for the letter is skipped
instead of drawing its .notdef box, known as tofu, which a few hundred times over teaches the
model a rectangle.
The model
A GAN’s latent space is smooth and walkable, which a morph needs; diffusion models make better single images and worse interpolations. StyleGAN2-ADA suits small datasets better but is licensed for research only, so this uses DiffAugment, which is BSD-licensed and gives most of the same benefit. The discriminator uses spectral rather than batch normalisation, because batch statistics at a batch size of 32 are too noisy. Labels are softened and about three percent are flipped, so the discriminator cannot win early and starve the generator of a gradient.

Training budgets in steps, not epochs: with a few hundred glyphs an epoch is a handful of steps. And small wins. A crisp 64-pixel model interpolates better than a soft large one, and a model with more parameters than pixels to fit collapses to a fixed pattern.
The walk is spherical rather than linear. A straight line between two Gaussian latents passes through norms the model never saw in training, so a linear morph washes out exactly halfway.
A second glyph
The same code, trained in 2026 on 1,356 ampersands, three faces per family, for 20,000 steps. An ampersand varies far more between typefaces than a lower-case a, and the walk moves between roman, italic and script forms.
