How we found three primary handwriting styles

The handwriting samples can be classified into three primary styles: scribbly print, bubbly print and cursive.

To better understand handwriting styles, we collected samples from 90 participants in Singapore across a wide age range. Each participant was asked to write the same sentence, a localised pangram, which includes every letter of the alphabet: “The quick hawker is ever unfazed as excited jumpy birds fling food.”

To identify the main handwriting style groups, we applied a multi-stage clustering process. We first grouped similar letters, then clustered full handwriting samples based on those patterns. We did not access participants’ ages during the clustering process to avoid bias. Age information was used only during the final statistical analysis.

Step 1: Cluster by individual letter types

We noticed that some people mixed different styles within a single sentence. To address this, we first clustered individual letter samples, such as the letter “g”, across all participants. Using k-means clustering, we grouped visually similar versions of each letter. This gave us representative shapes for each letter, which we used as a reference to measure similarity in later steps.

Three different styles identified for the letter “g” using k-means clustering

Step 2: Identify and remove outliers

We then calculated similarity scores for each participant’s sentence by comparing their letters to the representative shapes from Step 1. Samples that consistently had low similarity scores, such as very messy handwriting or sentences written entirely in capital letters, were flagged as outliers and removed. This step also helped identify distinct cursive styles and improved the overall consistency of the data.

Samples with low similarity scores were considered outliers.

Step 3: Cluster complete pangram samples

After removing outliers, we grouped the remaining handwriting samples by analysing the full sentence each participant wrote. For every letter in the sentence, we compared it with the three representative styles identified in Step 1 and noted which style it matched best. This gave us a pattern of style labels for each person’s handwriting.

Example of how letters in a handwriting sample are matched to their closest representative styles.

We then used these patterns to group similar handwriting samples. Because the data was categorical, we used the k-modes algorithm, which is suited for this type of data. We chose clustering over manual sorting as handwriting styles were often mixed and difficult to label consistently. Clustering gave us a more systematic way to organise the samples.

To decide how many style groups to create, we used the elbow method, a technique that tests different numbers of clusters to find the most suitable one. This process led to three distinct handwriting style groups. We then manually reviewed and refined a few samples to make sure each group looked visually cohesive.

Each pangram sample was grouped into one of three handwriting styles.

Finally, we tested whether handwriting style was related to age. We used the final clusters to run a chi-square test, a statistical method that checks for links between variables, and found a clear connection between generation and handwriting style.

How we designed handwriting-style detector

How handwriting-style detector works

Step 1: Detect letter for further classification

We used TensorFlow.js, a library for building and running machine learning models in the browser, to detect letters. Since we did not have enough handwriting samples to train a model from scratch, we tested several pre-trained models and chose the most accurate one. The model we used was trained on the EMNIST Letters dataset, which contains over 100,000 handwritten samples of all 26 letters in the alphabet.

EMNIST Letters dataset PHOTO: Cohen et al., 2017, arXiv:1702.05373

For each letter, the model gives its top three guesses. If the correct letter is one of them, it goes to a second check. This two-step process helps remove mistakes and keeps the analysis more accurate.

Step 2: Style classification

After a letter is detected, we analyse its shape using contour detection with OpenCV.js, a library for computer vision tasks in the browser. For selected letters, we identify unique features that vary across writing styles. One example is checking where the stroke ends, such as whether it finishes near the right or bottom edge. Each letter has its own set of simple, shape-based checks based on the contour of the handwriting. These features help classify the writing styles more accurately.

Process of matching a handwritten “y” to the most similar style

How we created a custom font for annotations

A custom font was used for the annotations.

We selected the font that was the most legible and easy to read, with considerations of accessibility. We used the style that came up in our analysis as the most definitive example from the bubbly style cluster.

Step 1: Trace over letters

We first began by creating individual vectors for each of the letters, tracing over the pangram to create a full set of alphabets.

A bubbly style sample was traced as an SVG to create the font.

Step 2: Create a font using FontLab

Each letter was exported as an individual SVG and imported directly into FontLab, which preserves Bezier curve data for high-quality vector rendering. Once imported, the glyphs were aligned, cleaned and adjusted for consistent baselines, spacing and kerning. FontLab’s robust tools made it easy to refine contours and set precise metrics.

Letters were imported into FontLab as SVGs, then cleaned and adjusted for alignment and spacing. PHOTO: FontLab

Step 3: Add variations to letter glyphs

To enhance the handwritten feel, we created multiple alternate versions of each letter and assigned them to OpenType features like calt (contextual alternates) or salt (stylistic alternates). This allowed the font engine to substitute different glyphs depending on letter sequences, adding rhythm and variation that mimic natural writing.

OpenType features enable glyph variation to simulate natural writing.

This, along with other hand-drawn visual elements such as animated arrow annotations, created an aesthetic that best emulated the unique qualities of handwriting for the piece.

View the interactive here.