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,一种上下文感知的风格化在线手写生成器,该生成器显式建模字符间连接性,以实现风格一致的句子级轨迹合成。CASHG使用字符上下文编码器获取字符身份和句子依赖的上下文记忆,并在一个双字母感知的滑动窗口Transformer解码器中融合这些信息,该解码器强调局部的前驱-当前转换,并辅以门控上下文融合以处理句子级上下文。训练过程通过从孤立字形到完整句子的三阶段课程进行,提高了在稀疏转换覆盖下的鲁棒性。我们进一步引入了连通性与间距度量(CSM),这是一个边界感知的评估套件,用于量化草书连续性和间距相似性。在基准匹配的评估协议下,CASHG在CSM上持续优于对比方法,同时在基于DTW的轨迹相似性方面保持竞争力,这些改进得到了人工评估的证实。