Skip to content
All work

Caligraf.ia

Personal project · 2026

Typed Portuguese in, handwritten pen strokes out. Trained from scratch, because the weights everyone uses are research-only and cannot ship.

0.42 → 0.70
legibility, four rounds
21.6k
synthetic stroke pairs
~9s
generation, CPU

Why Portuguese

Handwriting models are trained and demoed on English. Portuguese carries accents (á, ã, ç, ê) that are one or two pixels wide, which is exactly what a naive skeletoniser throws away when it reduces a glyph to a stroke. Getting them to survive the data pipeline was most of the work.

Pipeline

Open-licence cursive fonts are thinned to a one-pixel skeleton and walked to recover a pen trajectory. Small components are preserved deliberately, so the accents make it into the training data instead of being erased by the thinning step.

OFL fonts12 cursive faces1px skeletonskimagePen trajectoryaccents keptDataset21.6k pairsRNN trainingpriming 0.7Checkpointevery 500 stepsQuality gateTrOCR judgePromoteor discardscore below the frozen ruler → retrain
Fonts become strokes, strokes become a dataset, and no checkpoint ships until the frozen ruler scores it.

The gate

Training loss kept falling while the output stayed unreadable. So the ruler is external and frozen: an OCR model reads back what the checkpoint wrote, and the similarity is the score. CI for a generative model.

0.000.250.500.751.000.944 research baseline (IAM, not licensable)0.42sint1system fonts0.54ofl1open cursive fonts0.68ofl2open cursive fonts0.70ofl3open cursive fonts
Four rounds against the frozen corpus. The dashed line is the research baseline that cannot be licensed.

Runtime

Browsertext inputFlask API/generateRNN enginetorch, CPUSVG strokes~9s total
One request: text in, pen strokes back as SVG, about nine seconds on CPU.

Who built it

The source is closed, it is a running product with transactions in it. If you want to confirm who is behind it, the privacy policy on caligrafia.app carries my name and the registered company.

PyTorch · Python · Flask · NumPy · TrOCR · scikit-image