Abstract
Traditional generative models for images typically operate on pixel grids, which are ill-suited for structured design tasks like typography. We present a generative model that learns to produce fonts using Scalable Vector Graphics (SVG) commands. By disentangling character identity from visual style within a latent space, our model enables style propagation—generating entire font sets from a single character—and attribute manipulation via latent vector arithmetic.
Introduction
Most modern generative models, such as GANs or VAEs, represent images as regular grids of pixels. While effective for natural images, pixels fail to capture the structural essence of typography. Fonts are defined by mathematical paths and curves that maintain clarity at any scale. This work explores a deep learning approach to the "language" of SVG commands, aiming to capture the diversity of human-designed typefaces in a resolution-independent format.
Methods
Our architecture combines a Variational Autoencoder (VAE) with an autoregressive decoder to map rasterized characters into a structured vector space.
The Encoder
A convolutional network maps a rasterized character image to a latent code $z$. The model is class-conditioned, receiving the character label as input. This conditioning encourages the latent code $z$ to capture only the stylistic attributes (e.g., weight, slant, serif) while ignoring character identity.
The Decoder and MDN Layer
The decoder consists of four stacked Long Short-Term Memory (LSTM) networks. Instead of pixels, it predicts a sequence of SVG commands such as moveTo, lineTo, and cubicBezier. To handle continuous coordinate values, we employ a Mixture Density Network (MDN) as the final layer, allowing the model to output probability distributions over path coordinates.
Key Insights
- Style Disentanglement: Separating character labels from latent vectors allows for a style-agnostic representation. Applying the same $z$ to different labels yields a visually consistent font family.
- Scale Invariance: By outputting vector commands, the model produces graphics that can be scaled infinitely without loss of quality.
- Latent Space Arithmetic: The latent space is semantically organized, enabling vector arithmetic for style manipulation. For instance, adding a "boldness" vector to a latent code results in a heavier version of the original font.
Results
The model was trained on the SVG-Fonts dataset, comprising 14 million examples across 62 characters from 220,000 unique fonts.
- Style Propagation: Given a single unseen character, the model can encode its style and generate the remaining alphabet consistently.
- Diversity and Consistency: Qualitative analysis demonstrates the model's ability to capture a wide range of styles, from minimalist sans-serifs to complex decorative fonts, while maintaining high visual consistency across a generated set.
Conclusion
This work demonstrates the feasibility of learning a generative model directly in the space of vector graphics. While challenges remain in modeling extremely intricate designs and handling dataset noise, this approach provides a foundation for assistive design tools that can automate the tedious aspects of typeface creation.
Summary updated