Skip to content

feat: Simplified Chinese support (Ma Shan Zheng, 3500+ characters) #52

Description

@luojiyin1987

Summary

Add Simplified Chinese (简体中文) handwriting animation support with the Ma Shan Zheng (马善政) Google Font and a 3500+ character set from the 通用规范汉字表 (General Standard Chinese Characters Table, Level 1).

What is included

  • Character set: 3516 unique Chinese characters plus Chinese punctuation and Latin baseline (SIMPLIFIED_CHINESE_CHARS)
  • Font: Ma Shan Zheng — a calligraphy-style Google Font optimized for Chinese handwriting
  • Stroke data: Pre-computed stroke order from hanzi-writer-data (same data source as Hanzi Writer), eliminating the need for the rasterize → skeletonize → trace pipeline for CJK characters
  • Bundle: 3602 glyphs (3513 Chinese + 89 Latin), ~6MB glyphData.json, ~6MB TTF font files

Changes

  • packages/generator/src/hanzi-stroke-data.ts — New: Hanzi Writer data integration module for CJK stroke data
  • packages/generator/src/hanzi-stroke-data.test.ts — Tests for the Hanzi stroke data module
  • packages/generator/src/commands/generate.ts — Integrate Hanzi data source into glyph pipeline
  • packages/generator/src/charsets.ts — Add SIMPLIFIED_CHINESE_CHARS constant (3516 chars)
  • packages/generator/src/index.ts — Export the new charset
  • packages/generator/src/font/download.ts — Skip &text= parameter for large char sets (>8KB URL limit)
  • packages/renderer/scripts/generate-fonts.ts — Add Ma Shan Zheng to font generation config
  • packages/renderer/package.json — Add ./fonts/ma-shan-zheng subpath export
  • packages/renderer/fonts/ma-shan-zheng/ — Generated font bundle
  • packages/website/src/components/preview/ — Generator UI support for Simplified Chinese presets
  • packages/website/src/components/HomePageExamples.tsx — Add Chinese font to homepage examples
  • packages/website/src/content/docs/getting-started.mdx — Update docs
  • README.md — Add Ma Shan Zheng to built-in fonts list

Acknowledgments

This builds on the existing Japanese (Klee One) CJK support infrastructure. The multi-subset font downloading, CJK line-cap auto-detection, and HarfBuzz shaping were already in place.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions