A font created from a scanned handwriting sample, built with a fully automated Python pipeline.
90 glyphs · 3 formats (TTF, WOFF, WOFF2) · 61 kerning pairs · Auto-hinted
| File | Size | Format |
|---|---|---|
Handwritten.ttf |
29.0 KB | TrueType (desktop install) |
Handwritten.woff |
13.9 KB | Web Open Font Format |
Handwritten.woff2 |
11.5 KB | WOFF2 (best web compression) |
Font files are in the output/ directory.
- Uppercase: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- Lowercase: a b c d e f g h i j k l m n o p q r s t u v w x y z
- Numerals: 0 1 2 3 4 5 6 7 8 9
- Symbols: ! @ # $ % ^ & * ? / \ < > + =
- Punctuation: . , ' " - — ( ) [ ] : ; _
The pipeline (create_font.py) converts a scanned handwriting sheet into production font files in 6 phases:
- Image Preprocessing — Adaptive thresholding, border line removal, morphological noise cleanup
- Character Segmentation — Projection-profile row detection, contour-based character isolation with smart edge-artifact trimming
- Vectorization — OpenCV contour detection with polygon approximation (
approxPolyDP) for smooth outlines - Metrics Engineering — Cap height and x-height measured from actual glyph data; UPM-normalized spacing
- Font Assembly —
fontToolsFontBuilder with 61 kerning pairs, auto-hinting viattfautohint, multi-format export - Specimen Page — Dark-themed HTML page with character grids, size scale, kerning demo, and live editable text
Several custom fixes apply intelligent typographic rendering during vectorization:
- Dot Retention Algorithm: A localized X-overlap bounds intersection isolates small dots (for
i, j, ?, !) matching directly to their parent character logic, filtering out any background grid-paper noise. - Robust Local Baseline Anchoring: Hard-an
819B
chors each individual alphanumeric character's lowest Y-bound exactly to
Y=0(unless detected as descending sequences). This inherently corrects varying upward or downward baseline slants across the handwritten row, completely preventing accidental cross-screen descender mappings and "floaters". - Precision Symbol Mapping: Encodes custom horizontal sequence matching designed carefully for handwriting layouts, fixing index offsets of
( ) [ ] : ; —.
@font-face {
font-family: 'Handwritten';
src: url('Handwritten.woff2') format('woff2'),
url('Handwritten.woff') format('woff'),
url('Handwritten.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
body {
font-family: 'Handwritten', cursive;
}Install Handwritten.ttf by double-clicking it on Windows or Mac.
python -m http.server 8080 --directory output
# Then open http://localhost:8080pip install opencv-python-headless Pillow numpy fonttools brotli ttfautohint-pypython create_font.pyThis reads docs/6151945549901401701.jpg and outputs the font files + specimen page to output/.
| Tool | Purpose |
|---|---|
| OpenCV | Image preprocessing, contour detection, vectorization |
| fontTools | Font assembly (TTF/WOFF/WOFF2), metrics, kerning tables |
| ttfautohint | Auto-hinting for crisp rendering at small sizes |
| brotli | WOFF2 compression |
| Pillow / NumPy | Image manipulation utilities |
Free for personal and commercial use.