Table of Contents
Fetching ...

CASHG: Context-Aware Stylized Online Handwriting Generation

Jinsu Shin, Sungeun Hong, Jin Yeong Bak

Abstract

Online handwriting represents strokes as time-ordered trajectories, which makes handwritten content easier to transform and reuse in a wide range of applications. However, generating natural sentence-level online handwriting that faithfully reflects a writer's style remains challenging, since sentence synthesis demands context-dependent characters with stroke continuity and spacing. Prior methods treat these boundary properties as implicit outcomes of sequence modeling, which becomes unreliable at the sentence scale and under limited compositional diversity. We propose CASHG, a context-aware stylized online handwriting generator that explicitly models inter-character connectivity for style-consistent sentence-level trajectory synthesis. CASHG uses a Character Context Encoder to obtain character identity and sentence-dependent context memory and fuses them in a bigram-aware sliding-window Transformer decoder that emphasizes local predecessor--current transitions, complemented by gated context fusion for sentence-level context.Training proceeds through a three-stage curriculum from isolated glyphs to full sentences, improving robustness under sparse transition coverage. We further introduce Connectivity and Spacing Metrics (CSM), a boundary-aware evaluation suite that quantifies cursive connectivity and spacing similarity. Under benchmark-matched evaluation protocols, CASHG consistently improves CSM over comparison methods while remaining competitive in DTW-based trajectory similarity, with gains corroborated by a human evaluation.

CASHG: Context-Aware Stylized Online Handwriting Generation

Abstract

Online handwriting represents strokes as time-ordered trajectories, which makes handwritten content easier to transform and reuse in a wide range of applications. However, generating natural sentence-level online handwriting that faithfully reflects a writer's style remains challenging, since sentence synthesis demands context-dependent characters with stroke continuity and spacing. Prior methods treat these boundary properties as implicit outcomes of sequence modeling, which becomes unreliable at the sentence scale and under limited compositional diversity. We propose CASHG, a context-aware stylized online handwriting generator that explicitly models inter-character connectivity for style-consistent sentence-level trajectory synthesis. CASHG uses a Character Context Encoder to obtain character identity and sentence-dependent context memory and fuses them in a bigram-aware sliding-window Transformer decoder that emphasizes local predecessor--current transitions, complemented by gated context fusion for sentence-level context.Training proceeds through a three-stage curriculum from isolated glyphs to full sentences, improving robustness under sparse transition coverage. We further introduce Connectivity and Spacing Metrics (CSM), a boundary-aware evaluation suite that quantifies cursive connectivity and spacing similarity. Under benchmark-matched evaluation protocols, CASHG consistently improves CSM over comparison methods while remaining competitive in DTW-based trajectory similarity, with gains corroborated by a human evaluation.

Paper Structure

This paper contains 44 sections, 50 equations, 19 figures, 7 tables.

Figures (19)

  • Figure 1: Inter-character connectivity and spacing comparison. Rows show style reference, CASHG, and the benchmark-matched comparison protocol. Columns compare connectivity and spacing under DSD and DeepWriting settings.
  • Figure 2: Overview of CASHG. Reference handwriting images are encoded into Writer-style memory$\mathbf{M}^{\mathrm{w}}$ and Glyph-style memory$\mathbf{M}^{\mathrm{g}}$. The Character Context Encoder is used in two input modes: isolated-character inputs produce deterministic Character-Identity Embeddings, while sentence inputs are further processed by a lightweight Transformer encoder to produce position-dependent context memory. The handwriting generator synthesizes trajectories with a bigram-aware sliding-window Transformer decoder and integrates context memory through gated context fusion, enabling writer-consistent glyph formation together with explicit inter-character connectivity modeling (spacing/kerning and cursive joins).
  • Figure 3: Bigram-aware sliding-window Transformer decoding with gated context fusion. CASHG decodes each character from a predecessor--current local window and autoregressively predicts trajectory deltas (GMM-based). Writer-style and Glyph-style memories provide stylization cues, and sentence-level context memory is fused through a learnable gate to adapt generation to local context, improving inter-character connectivity (e.g., kerning and cursive joins).
  • Figure 4: Human evaluation of perceptual similarity in style, connectivity, and spacing under two comparison protocols (DSD, DeepWriting). Tie denotes Cannot judge.
  • Figure 5: Qualitative sentence-level comparison on BRUSH (English) and CASIA (Chinese). English examples use BRUSH ground truth and are sampled from the corresponding subset of our merged IAM and BRUSH dataset. Compared with DSD and OLHWG, CASHG better preserves writer-consistent glyph shape and sentence-level structure, including local connectivity and spacing patterns.
  • ...and 14 more figures