Building a Chinese Font from a Brother's 20-Year-Old Letter with Claude
The author uses Claude to create a Chinese font "Chao" from 75 characters in a 20-year-old handwritten letter, detailing the technical process of vector tracing, component decomposition, stroke library construction, leave-one-out validation, and the challenges of scaling to thousands of characters while preserving handwriting consistency.
What a Font File Contains
A font file stores each glyph's outline as a series of Bézier curves, allowing infinite scaling without blur. Every glyph sits in an invisible square called the em square, typically divided into 1000 units that define glyph size, side bearings, and advance width. Beyond outlines, font files embed layout rules such as vertical-form punctuation positioning and contextual alternates, which the OS and typesetting engines interpret. A single non-conforming glyph can cause the whole font to be rejected, so validation tools like OTS and shaping engines like HarfBuzz are used to test horizontal and vertical layout after each generation.
Why Chinese Fonts Are Harder
An English font needs roughly 100 glyphs (letters, digits, common symbols). Chinese is orders of magnitude larger: GB2312 contains 6,763 hanzi; the 1988 List of Frequently Used Characters states 2,500 characters cover 97.97% of corpora. The brother's letter, after deduplication, yielded only 75 unique hanzi.
Quantity is just the first hurdle. Hanzi are assembled from components that change shape depending on position: the "口" component must be narrow in "叶", small in "品", and expanded to fill the frame in "回". Professional designers spend years adjusting optical center, weight distribution, and stroke consistency across thousands of glyphs — a typical Chinese font takes one to two years.
Handwriting fonts add another layer: they must appear written by the same person, same day, same pen. Glyph size variation is acceptable, but stroke weight, slant angle, and ligature habits must stay consistent; otherwise a paragraph immediately looks synthetic.
First Version: 146 Characters
The first step was cropping each character from the letter photo and matching them to the text. Each glyph was only about 65 pixels tall with strokes roughly 4 pixels wide. The author upscaled them and used potrace to trace vector outlines, producing 75 "true" glyphs — the most authentic part of the font.
Using existing radicals from the letter, 71 additional characters were assembled by component recombination (e.g., "他" = 亻 from the letter + "也" from "地"). This yielded the first version: 146 glyphs.
Building a Component Structure Table
With only 146 glyphs, any real text falls back to a system font (e.g., Songti), creating jarring visual mismatches. To compose more characters, the author needed an Ideographic Description Sequence (IDS) table mapping each character to its components. While public IDS data exists, licensing concerns led to building a custom table: Claude recursively decomposed characters from the most frequent ones (e.g., "谢" = 讠 + "射"; "射" = "身" + "寸").
The structure table exposed a critical gap: the letter lacked entire component categories — no three-dot water radical (氵) meant zero characters with that radical could be assembled.
Stroke Library: Assembling Unseen Characters
To generate missing components, Claude extracted 1,105 individual strokes from the true glyphs — horizontals, verticals, left-falling, right-falling, dots, and various hooks. These strokes were recombined into new components, then into new characters.
To validate the approach, a leave-one-out test was run: hide a known glyph, reconstruct it solely from other glyphs' strokes, and compare. The reconstructed "地" and "这" closely matched the originals; characters like "河、沙、活" received their three-dot water radicals entirely from synthesized components.
Initial excitement faded on closer inspection: stitching artifacts were visible, especially in complex radicals like the walking radical (走之旁). Such micro-adjustments are the daily work of professional font designers across thousands of glyphs.
Current Issues and Future Plans
The font, named "Chao" (超), currently contains 1,048 glyphs but remains far from production-ready. The root cause is the tiny source sample: only 75 original glyphs capture neither the full range of stroke pressure nor the subtle entry/exit dynamics. Every additional glyph is essentially a guess.
The author plans to abandon the stroke-reassembly pipeline because it discards the most precious quality of handwriting: the continuous flow where the end of one stroke pulls the start of the next, with weight and speed varying organically. Isolated strokes lose that connectivity; when recombined, they look like they were written at different times.
Low-stroke-count characters ("一、人、大、口") are the hardest — no surrounding components to mask imperfections; a synthesized "口" becomes a rigid box.
The new strategy: use the 146 verified glyphs as a foundation, produce small batches with meticulous per-glyph tuning against the original letter, prioritizing authenticity over coverage. Longer term, the author wants to explore few-shot generative methods for handwriting style transfer, but results are uncertain and will be shared only if promising.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Old Zhang's AI Learning
AI practitioner specializing in large-model evaluation and on-premise deployment, agents, AI programming, Vibe Coding, general AI, and broader tech trends, with daily original technical articles.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
