Elsevier

Knowledge-Based Systems

Volume 186, 15 December 2019, 104927
Knowledge-Based Systems

GlyphGAN: Style-consistent font generation based on generative adversarial networks

https://doi.org/10.1016/j.knosys.2019.104927Get rights and content

Abstract

In this paper, we propose GlyphGAN: style-consistent font generation based on generative adversarial networks (GANs). GANs are a framework for learning a generative model using a system of two neural networks competing with each other. One network generates synthetic images from random input vectors, and the other discriminates between synthetic and real images. The motivation of this study is to create new fonts using the GAN framework while maintaining style consistency over all characters. In GlyphGAN, the input vector for the generator network consists of two vectors: character class vector and style vector. The former is a one-hot vector and is associated with the character class of each sample image during training. The latter is a uniform random vector without supervised information. In this way, GlyphGAN can generate an infinite variety of fonts with the character and style independently controlled. Experimental results showed that fonts generated by GlyphGAN have style consistency and diversity different from the training images without losing their legibility.

Introduction

There is a variety of fonts in the world. As shown in Fig. 1, fonts are characterized by various components such as the thickness of lines, decoration, and serifs. There are also handwritten-like fonts, fonts made of outlines, fonts with lowercase letters capitalized, and so on. Among these fonts, the best ones will be chosen according to the medium such as books, newspapers, signboards, and web pages. Even for the same medium, different fonts can be used depending on the title, text, and speakers. In response to these demands, a large number of fonts have been created.

This study aims at the automatic design of fonts; a computer automatically generates various fonts instead of a human designing fonts individually. There are two reasons why we aim at automatic design even though a large number of fonts already exists.

The first aim is to reduce the labor for creating a new font. Even today, new fonts are still being created. When a font is created, a large number of characters with the same style should be designed. In the case of alphabetic fonts, not only 52 upper/lowercase letters but symbols also are designed. For Japanese fonts, the labor increases because the Japanese language has a large number of letters including hiragana, katakana, and kanji. Therefore, automatic font design can potentially reduce this labor by a large extent.

The second aim is to understand designers’ tacit knowledge via a constructive approach. Basically, fonts are created by designers individually. This know-how is fundamentally cultivated by the designer’s experience and is not easily systematized. Reproduction of the process where a designer becomes able to create new fonts will lead to new knowledge of character design.

To realize the above aims, the following approaches can be considered.

  • 1.

    Designing all characters from a few samples: After manually designing a few examples as templates, the system automatically designs the remaining characters using these templates. This approach is effective, particularly for character sets with many of the same parts such as Chinese characters.

  • 2.

    Transformation and interpolation: A new font is made of existing fonts via operations such as changing the thickness of lines, adding decorations, and calculating an interpolation of two fonts. This approach has difficulty in designing a completely novel font because the generated font depends on the original font.

  • 3.

    Generating fonts automatically using machine learning: Utilizing a large number of fonts, a computer is trained to learn the design principle. If the computer can learn the designer’s know-how, which is difficult to describe explicitly, then automatic font design with a high degree of freedom is realized.

Studies related to the above approaches are described in the next section.

This study focuses on approach #3, i.e., machine learning-based font generation. This approach mainly includes two methods: transformation-based and generative model-based methods. In the former, a font is generated by adding style information to the existing font [1], [2], [3]. The latter estimates the manifold that the existing fonts compose in the image space, and then generates new font images by sampling data from the estimated manifold [4], [5]. This second method has the potential to generate more diverse fonts although there are challenges in the manifold estimation and generation stability.

Related to the generative model-based method, generative adversarial networks (GANs) [6] have attracted much attention in terms of image generation. GANs are a framework for learning a generative model using a system of two neural networks competing with each other. One network generates synthetic images from a random input, and the other discriminates between synthetic and real images, thereby allowing the generation of highly realistic images. However, it is basically difficult to control the characteristics of the generated images using GANs because GANs generate images from random input. Considering the application to font generation, the generated font should have the same style for all characters.

In this paper, we propose a font generation method based on GANs, which is named GlyphGAN. In GlyphGAN, the input vector for the generator network consists of two vectors: character class vector and style vector. The former is a one-hot vector and is associated with the character class of each sample during training. The latter is a uniform random vector without supervised information. In this way, GlyphGAN can generate an infinite variety of fonts with the character and style independently controlled.

The main features of the proposed GlyphGAN are as follows:

  • Style consistency: GlyphGAN can generate a font that has the same style over all characters.

  • Legibility: The generated fonts are legible compared with the other methods.

  • Diversity: The generated fonts have diversity different from the training images.

Section snippets

Example-based font generation

Various attempts have been made in previous studies on automatic font design. One of the classical methods is example-based font generation [7], [8], [9], [10]. For example, “A” is generated from human-designed “B”, “C”, , “Z”. Tenenbaum and Freeman [7] used several font sets containing all alphabets to separate them into standard shapes of individual alphabets and font styles. Then, the style of example patterns was extracted by using the standard shape and applied to the other alphabets.

Overview

GANs are a framework for estimating a generative model composed of two neural networks called the generator G and the discriminator D. The generator takes a vector of random numbers z as an input, and produces data with the same dimensions as the training data. Meanwhile, the discriminator discriminates between samples from real data and data generated by the generator. The original version proposed by Goodfellow et al. [6] is called the vanilla GAN.

In the training, G and D play the minimax

GlyphGAN: Style-consistent font generation

Fig. 2 shows an overview of GlyphGAN. The major differences from the ordinary GANs are as follows.

  • The input vector z of the generator G consists of a style vector zs and a character class vector zc.

  • During training, the character class vector zc is associated with the character class of the training pattern.

Font generation experiment

To evaluate the capability of the proposed method, we conducted a font generation experiment. We evaluated the generated fonts from the following viewpoints:

  • Legibility: We verify that the generated font has legibility via a character recognition experiment using a pretrained CNN.

  • Diversity: We validate whether the generated font set has diversity different from the training data.

  • Style consistency: We qualitatively verify that the generated font has style consistency via visual observation, and

Discussion

Difference from existing GANs: As stated in Section 3, various GAN derivations have been proposed. The most similar types are GANs that can control the output such as the conditional GAN [27]. The main structural differences from such GANs are that the character class information is provided only to the generator’s input, and that the sampling from the real data distribution is associated with the character class. The procedure intrinsically makes GlyphGAN learn the conditional distribution of

Conclusion

In this paper, we proposed GlyphGAN a style-consistent font generation based on generative adversarial networks (GANs). In GlyphGAN, the input vector for the generator network consists of a character class vector and style vector, thereby allowing font generation with style consistency. In the font generation experiment, we showed that the learning method employed in the proposed method improved the legibility of the generated fonts. The experimental results also showed that the generated font

Acknowledgment

This work was partially supported by JSPS KAKENHI Grant Number JP17H06100.

References (34)

  • TenenbaumJ.B. et al.

    Separating style and content with bilinear models

    Neural Comput.

    (2000)
  • LakeB.M. et al.

    Human-level concept learning through probabilistic program induction

    Science

    (2015)
  • MiyazakiT. et al.

    Automatic generation of typographic font from a small font subset

    IEEE Comput. Graph. Appl.

    (2019)
  • PhanH.Q. et al.

    Flexyfont: Learning transferring rules for flexible typeface synthesis

    Comput. Graph. Forum

    (2015)
  • Y. Wang, H. Wang, C. Pan, L. Fang, Style preserving Chinese character synthesis based on hierarchical representation of...
  • CampbellN.D. et al.

    Learning a manifold of fonts

    ACM Trans. Graph.

    (2014)
  • S. Uchida, Y. Egashira, K. Sato, Exploring the world of fonts for discovering the most standard fonts and the missing...
  • Cited by (0)

    No author associated with this paper has disclosed any potential or pertinent conflicts which may be perceived to have impending conflict with this work. For full disclosure statements refer to https://doi.org/10.1016/j.knosys.2019.104927.

    View full text