Evotype: Towards the Evolution of Type Stencils

We present an approach for the automatic evolution of glyphs based on type stencils. It employs Evolutionary Computation to create stencils to draw glyphs for different characters automatically. Each evolving stencil consists of an arrangement of visual elements, such as line segments, that make up the glyphs. The recipe that defines how the stencil can be used to draw each glyph is also evolved.

Figure 1

Demo of the Evotype system

Thus, the main contribution presented herein is a generative system capable of automatically creating stencils to draw coherent glyphs. Other contributions include: (i) an exploration of how evolutionary approaches may inform contemporary graphic design practices; (ii) an investigation into the interplay between legibility, coherence, and expressiveness; (iii) a generic evolutionary framework that integrates an evolutionary and an evaluation module for the generation of stencils to draw coherent glyphs with different degrees of detail and abstraction; (iv) an investigation into the relationships among the different parts that build glyphs; and (v) a showcase of the application of the generated results, allowing designers to create new type explorations.

A demo of the working Evotype system can be seen in figure 1.




This work is based on the idea of a stencil capable of generating every letter of the alphabet in a coherent manner. In 1876, the American engineer Joseph A. David developed the Plaque Découpée Universelle, mostly known as the PDU (see figure 2). This stencil consists of a complex grid that allows the construction of all uppercase and lowercase letters, numbers, punctuation, accents, etc.

Figure 2

Plaque Découpée Universelle (PDU), Joseph A. David, 1876

We developed a system that evolves type stencils and thus explores the interplay between the flexibility and the restrictions they provide while designing glyphs. The system integrates two main modules: (i) the evolution module, which implements a Genetic Algorithm (GA) to generate candidate stencils, and (ii) the evaluation module, which implements automatic fitness assignment schemes to evaluate the glyphs provided by the first module.


The evolution module uses a GA to evolve a population of stencils. Each stencil being evolved with the system is constructed from line segments. Thus, the genotype is a set of pairs of points (x,y). The mapping mechanism that expresses each genotype into its phenotype consists in the drawing of black line segments encoded in the genotype on a white canvas. The mapping process is not direct. We require the mapping for each character we want to draw with the stencil. We developed a mapping mechanism based on binary masks that define how a given stencil is used to draw a given glyph. When we say *how*, we mean which line segments are used.


For the evaluation module, we implemented an automatic fitness assignment scheme to guide the evolution of stencil autonomously. In short, the fitness of a stencil consists in the evaluation of the best glyphs it can produce. Therefore, each stencil is evaluated in how well it performs in drawing glyphs for the target characters. First, the system chooses a character for which the stencil has to produce glyphs. Next, among the stencil’s segments, we search which configuration of active segments better expresses glyphs for the chosen character. To perform the search for the best stencil’s configuration for each target character we use a hill-climbing algorithm. This way, each mask stores the best configuration, of the stencil found during the evaluation process to draw a given character. Each mask is evaluated by how the expressed glyph maximises a predetermined glyph evaluation function. Each stencil’s configuration is evaluated based on the visual similarity of its expression with a preset glyph of the target character. This way, after the stencil’s configuration and the target glyph, are rendered to an image representation, the similarity between the two images is calculated using a pixel-by-pixel comparison using a Root Mean Squared Error method.


We tested some fitness function variations to evaluate the stencil’s configuration explained in each experiment in the following sections. You can read more details here.




Experiment 1 focus on the ability of the system to evolve stencils. Figure 3 shows typical results evolved in different runs. The results obtained demonstrate the ability of the system to evolve stencils that produce glyphs similar to the targets. Nevertheless, the system can provide diversity in terms stencils, thus generating glyphs with different features. Also, one can observe the reuse of stencils’ elements among the glyphs. This behaviour is crucial as it creates coherence and unity in the glyphs.

Figure 3

Typical stencils evolved in experiment 1

In experiment 2, we add two components to the stencils’ evaluation that takes into consideration the number of elements and the gaps between them. We approach two issues identified in the results obtained in experiment 1: (i) the high number of elements that compose the stencils and (ii) the several gaps that appear between the elements. To do so, we designed another the fitness function, to control the number of elements and minimise the gaps. This fitness takes based on two variables. One variable that controls the number of elements in use by a given stencil. The other variable controls the elements that are contained in other elements of the same stencil.


The simplicity of the glyphs produced in this experiment makes the reuse of the stencils’ elements among the glyphs more noticeable (figure 4). However, the reduced number of elements forces the evolutionary process to compromise between the abstraction and the complete glyphs’ structures, resulting in glyphs with some missing parts. In most of the cases where parts of the glyphs were missing, we noticed that those parts are typically specific to one glyph and therefore no other glyphs use them.

Figure 4

Typical stencils evolved in experiment 2

In experiment 3 we further investigate one stencils’ property that we consider fundamental: the reuse of elements to draw different glyphs. The data from experiment 2, demonstrates that the stencils reuse many of its elements to draw the different glyphs, predominantly the ones that are visually similar. Based on this analysis, we set one last evolutionary experiment: evolve stencils to draw all glyphs with only a subset being evaluated by the fitness function. Based on the data from the previous experiments, the subset used is composed of the characters: { ‘B’, ‘I’, ‘Q’, ‘V’, ‘W’, ‘X’ }. Based on the results attained in figure 5, we demonstrate that stencils evolved to draw a small set of glyphs can be used to draw other glyphs.

Figure 5

Typical stencils evolved in experiment 3

In the experiment 4, we explore the creative possibilities created with the stencils evolved with the system. To do so, we asked two graphic designers to create a series of typefaces using evolved stencils. We created a program that takes one stencil as input and replaces its elements with custom shapes designed by the user. The user can set which shape should replace each stencil’s element, or opt for a random configuration. The program assembles the final glyphs on the fly. Therefore, the user can gain quickly an idea of what sort of effect any change has on the final glyphs (see figure 6).

Figure 6

Elements of an evolved stencil replaced with different sets of shapes

The video in figure 7 showcases the system evolving different stencils and applying different custom shapes at the end of each evolution. First, it shows the evolution of a stencil from scratch until we achieve the number of desired populations (represented by the bottom loading bar). After finishing evolving the stencil, the shapes that compose the active segments of the stencil are changed, providing different visual outputs. Hence, the stencil maintains coherence across the glyphs, with different glyphs showing a similar style. When the users employ randomness into their custom shapes, our approach can generate always changing glyphs that maintain coherence.

Figure 7

Different evolutionary runs

The results demonstrate the ability of this approach to provide creative possibilities even within the fixed structure of the stencil.


In Proceedings

  • T. Martins, J. Correia, E. Costa, and P. Machado, “Evotype: Towards the Evolution of Type Stencils,” in Computational Intelligence in Music, Sound, Art and Design, Cham, 2018, pp. 299-314.


Tiago Martins

Ernesto Costa

Penousal Machado