Towards Diverse and Consistent Typography Generation

Wataru Shimoda, Daichi Haraguchi, Seiichi Uchida, Kota Yamaguchi

TL;DR

Researchers from CyberAgent and Kyushu University have developed a new Transformer-based model that automatically generates diverse yet stylistically consistent typography for graphic documents. By introducing a "structure-preserved sampling" technique, the model ensures that related text elements share uniform styling while still offering designers a wide variety of creative options that respect the visual context of the background image.

What Problem Does This Paper Address?

Typography is a cornerstone of graphic design, influencing legibility, brand perception, and visual hierarchy. However, automating typographic styling is notoriously difficult because it requires balancing four competing needs:

  1. Context Awareness: Styling must match the background visuals and the semantic meaning of the text (e.g., a "SALE" banner needs more weight than a footer).
  2. Fine-grained Control: Beyond just font and color, designers care about letter spacing, line height, alignment, and angles.
  3. Consistency and Distinction: Elements with similar roles (like menu items) should look identical, while different roles (like a title vs. a caption) should be distinct.
  4. Diversity: There is rarely one "correct" design; a system should suggest multiple valid creative directions.

Existing "raster-based" generators often produce blurry text artifacts, while previous attribute-based models often struggle to maintain design harmony across multiple text elements on a single page.

Methods

The authors formulate typography generation as a fine-grained attribute generation task. They handle eight distinct attributes, ranging from semantic choices like font family and capitalization to geometric ones like letter spacing and rotation angle.

Figure 2. An illustration of typographic attributes. We handle semantic quantities including font, color, alignment, and capital- ization and geometric quantities including font size, angle, letter spacing, and line spacing.

The Architecture

The model uses a Transformer-based encoder-decoder architecture.

  • Encoder: Processes the "context," which includes the background image (via a ResNet50), text content (via a CLIP encoder), and the rough positions of text elements.
  • Decoder: Generates typographic attributes autoregressively. This means the model "looks" at the styling it chose for the first text element before deciding on the styling for the next, helping to maintain flow.
The Transformer-based encoder-decoder architecture used to capture interactions between input context and typographic attributes.

Structure-Preserved Sampling

The paper's most significant contribution is a two-step inference approach to solve the "consistency vs. diversity" trade-off:

  1. Predict Structure: The model first performs a "top-1" prediction (choosing the most likely styling) to determine which text elements should share the same style.
  2. Sample Diverse Attributes: It then clusters these elements based on that predicted structure. When sampling for a new design, it draws a random style for the first element in a cluster and forces all other elements in that same cluster to adopt that style. This prevents the "ransom note" effect where every word has a different, clashing font.

Datasets

The authors utilized the Crello dataset, which contains thousands of professional design templates. Because the original dataset lacked some typographic metadata, they augmented it by:

  • Collecting corresponding .ttf font files.
  • Parsing vector-graphic details to extract ground truth for all eight typographic attributes.
  • Splitting the resulting 23,475 templates into training, validation, and test sets (8:1:1 ratio).

Key Insights and Ideas

  • Consistency is a Pairwise Relationship: The authors define "typography structure" not as a fixed layout, but as a set of pairwise consistency relationships between elements. This allows the model to be flexible across different document types.
  • The "Ransom Note" Problem: Standard "top-p" sampling in autoregressive models often breaks design consistency as the diversity increases. Their structure-preserved sampling acts as a constraint that keeps the design "sane" even when exploring wilder creative variations.
  • Geometric vs. Semantic Attributes: The study found that geometric attributes (like font size and angle) require much tighter sampling (lower diversity) to avoid visually disturbing results, whereas semantic attributes (font family, color) can be varied more freely.

Key Results

The model was compared against baselines like MFC (a single-element prediction model) and CanvasVAE (a layout-focused VAE).

  • Quantitative: The proposed model achieved significantly higher Structure Scores (measuring how well it maintained consistency compared to ground truth) across all attributes. For example, in font consistency, it scored 68.6% compared to CanvasVAE's 62.0%.
  • Qualitative: In a user study with 1,000 responses, participants overwhelmingly preferred the designs generated by this model over the baselines, noting that it better respected the background context and maintained a professional look.
Figure 1. We formulate the fine-grained typography generation task considering the structure of multiple texts. a) An example of an input context: background image, texts, and their corresponding center positions. b) Typographic structure predicted by our model via top-1 sampling. c) Generated typography by our structure-preserved sampling.

Limitations and Future Work

Despite the improvements, the authors noted several remaining challenges:

  • Spatial Awareness: The model sometimes generates text that overlaps or overflows its intended area because it doesn't explicitly calculate the final rendered width of the text.
  • Contrast Issues: Occasionally, the model selects font colors that are too similar to the background, making the text hard to read.
  • Future Directions: The team aims to improve the "fidelity of colors" relative to backgrounds and explore how to better model human perception of font similarities rather than treating every font as a unique categorical ID.

Summary updated

BibTeX
@inproceedings{shimoda2024towards,
  author = {Wataru Shimoda and Daichi Haraguchi and Seiichi Uchida and Kota Yamaguchi},
  title = {{Towards Diverse and Consistent Typography Generation}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
}
Figure