DA-Font: Few-Shot Chinese Font Generation
- DA-Font is a few-shot font generation framework that creates new glyphs from a limited set of reference images while preserving the character’s content.
- It employs a Dual-Attention Hybrid Module that integrates component attention for style consistency and relation attention for structural coherence.
- The method demonstrates improved structural accuracy, local detail preservation, and fewer stroke errors compared to previous few-shot font generation techniques.
DA-Font is a few-shot font generation framework introduced for synthesizing new glyphs from a limited number of reference glyphs. In the reported setting, the model receives a small set of reference glyph images from a target style and a content image , and produces a glyph that preserves the content or character identity of while adopting the style of the reference set. Its defining mechanism is the Dual-Attention Hybrid Module (DAHM), which combines a component attention block and a relation attention block in order to preserve accurate character shapes and stylistic textures; the paper further introduces a corner consistency loss and an elastic mesh feature loss to improve geometric alignment (Chen et al., 20 Sep 2025).
1. Problem formulation and intended scope
DA-Font addresses few-shot font generation, a setting in which a target font style must be inferred from only a small number of exemplars. The paper states that this is especially important for scripts such as Chinese, Japanese, and Korean, where manually designing thousands of characters per font is expensive. In its experimental configuration, the method is evaluated on Chinese fonts and uses four reference images during generation (Chen et al., 20 Sep 2025).
The stated motivation is that existing few-shot methods often suffer from visible defects, including stroke errors, artifacts, blurriness, and structural inconsistencies. The paper attributes these failures to the difficulty of preserving three properties simultaneously: global character structure, local style details, and component-level consistency. DA-Font is presented as a response to the claim that earlier methods often do not use component information effectively to mediate interactions between content and style features. In this formulation, component information is not merely descriptive; it is used to guide feature interaction during style transfer (Chen et al., 20 Sep 2025).
The model represents content with a structural feature map extracted from the content image , style with reference features extracted from the few style exemplars, and component structure with a component-wise codebook learned by a pre-trained VQ-VAE content encoder. This design places DA-Font within the few-shot font generation literature rather than within font recognition or retrieval systems.
2. Learned representations and feature decomposition
Before training the main generator, DA-Font pre-trains its content encoder using a glyph reconstruction network. The content encoder maps a glyph image to a latent representation , after which vector quantization replaces each latent vector by its nearest codebook entry:
0
Here 1 is the 2-th latent vector in 3, 4 is the 5-th codebook entry, and 6 is the codebook with 7 code vectors (Chen et al., 20 Sep 2025).
The pretraining objective is
8
with 9 and 0. After this stage, 1 and the codebook 2 are fixed for the main model. The paper characterizes the resulting representation as a discrete component-oriented representation of glyph structure (Chen et al., 20 Sep 2025).
In parallel, a reference encoder 3 encodes the 4 reference glyphs into style latent features
5
DA-Font also includes a content alignment module, motivated by the observation that some reference glyphs may share more structural similarity with the target content than others. The module extracts content features 6 from the reference glyphs via 7, computes normalized cross-correlation channel-wise with the target content feature 8, softmax-normalizes the similarities, and uses them to aggregate the style channels into a content-aware aligned feature 9 (Chen et al., 20 Sep 2025).
This decomposition yields three distinct inputs to the downstream generator: the content feature 0, the content-aligned style feature 1, and the codebook-derived component information 2. A plausible implication is that DA-Font treats character generation as a structured fusion problem rather than as flat concatenation of content and style embeddings.
3. Dual-Attention Hybrid Module
The Dual-Attention Hybrid Module is the central architectural contribution. It contains two blocks with different roles. The component attention block produces a stylized component codebook 3 by using the content codebook 4 to query the style features 5. The relation attention block then uses the content feature 6 to query relations between the original component codebook 7 and the stylized codebook 8, producing a refined style representation 9 (Chen et al., 20 Sep 2025).
Component attention block
The inputs are the component-wise codebook
0
and the style features 1. The style features are reshaped and concatenated along the spatial dimension into
2
The block is implemented as a multi-head transformer with 3 heads. For head 4,
5
6
7
The attention output is
8
followed by
9
This makes the component codebook the query and the reference style features the key/value set, so each learned component prototype selectively retrieves style evidence from the exemplars (Chen et al., 20 Sep 2025).
The block then applies Graph Feature Propagation. For components 0 and 1 in 2, the adjacency matrix is
3
and an auxiliary score matrix is
4
The refined codebook is
5
and the stylized codebook becomes
6
The paper interprets this as component-wise style transfer followed by interaction propagation across components (Chen et al., 20 Sep 2025).
Relation attention block
The relation attention block takes 7, 8, and 9 as input and outputs
0
The content feature map is reshaped into
1
and for attention head 2,
3
4
5
Thus the content feature is the query, the original codebook is the key, and the stylized codebook is the value (Chen et al., 20 Sep 2025).
Before attention, the paper applies a Local Feature Refiner to 6 and 7. The importance of pixel 8 in region 9 is defined as
0
and the refiner is implemented by stacking a SoftPool operation followed by a 1 convolution. The paper also uses stride and squeeze convolutions to enlarge receptive field, sigmoid and linear interpolation for rescaling, and a gating mechanism:
2
The attention output is then
3
and after multi-head aggregation,
4
with 5. Reshaping 6 back to spatial form yields 7 (Chen et al., 20 Sep 2025).
The full generator uses the concatenation 8 as decoder input. In the paper’s interpretation, the component attention block improves style consistency and radical alignment, while the relation attention block refines spatial dependency modeling and structural coherence.
4. Objective functions and optimization
DA-Font combines adversarial, reconstruction, contrastive, and geometry-oriented losses. A multi-task discriminator 9 is used for adversarial real/fake discrimination as well as style and content classification (Chen et al., 20 Sep 2025).
The adversarial losses are
0
and
1
The matching losses include an image-space 2 term
3
and a discriminator feature-matching term
4
The paper states that the image loss improves pixel fidelity and the feature matching loss stabilizes GAN training and reduces mode collapse (Chen et al., 20 Sep 2025).
To make style representations discriminative while ignoring reference content, the model uses a style contrast loss:
5
Here 6 denotes positive samples with the same style and different content, and 7 denotes negative samples with the same content and different styles (Chen et al., 20 Sep 2025).
Two additional losses explicitly target geometric alignment. The corner consistency loss uses Shi-Tomasi corner detection:
8
The elastic mesh feature loss is
9
The paper describes the first as preserving critical junction points and the second as preserving local structural consistency and topological coherence (Chen et al., 20 Sep 2025).
The full objective is
0
with
1
Training is divided into two stages. In stage 1, the decomposition network is pretrained on 3000 Chinese characters in the font kai, with embedding dimension 256, codebook size 100, batch size 64, and 50,000 iterations. In stage 2, the full model is trained with Adam, batch size 8, generator learning rate 2, discriminator learning rate 3, and 600,000 iterations (Chen et al., 20 Sep 2025).
5. Experimental protocol and empirical results
The experiments use a collected Chinese font dataset containing 575 fonts and 3500 commonly used Chinese characters per font at resolution 4. The font kai is fixed as the content font for both training and testing, and is also used to pretrain the decomposition network. The training set, denoted SFSC, contains 550 fonts and 3000 characters per font. Two test settings are reported: UFUC, with 24 unseen fonts and 500 unseen characters per font, and SFUC, with 550 seen fonts and 500 unseen characters per font (Chen et al., 20 Sep 2025).
The paper compares DA-Font against FUNIT, MX-Font, DG-Font, LF-Font, CF-Font, VQ-Font, FontDiffuser, and IF-Font. Evaluation uses SSIM, RMSE, LPIPS, FID, 5, and a user study (Chen et al., 20 Sep 2025).
| Setting | SSIM / RMSE / LPIPS / FID / L1 | User study |
|---|---|---|
| UFUC | 0.7352 / 0.2854 / 0.1699 / 54.1856 / 0.0872 | 20.10% |
| SFUC | 0.7287 / 0.3019 / 0.1792 / 49.2237 / 0.1116 | 17.85% |
On UFUC, DA-Font improves over IF-Font from SSIM 0.6891 to 0.7352, RMSE 0.3130 to 0.2854, LPIPS 0.2173 to 0.1699, FID 59.6292 to 54.1856, 6 0.1038 to 0.0872, and user preference 14.15% to 20.10%. Compared with VQ-Font on UFUC, SSIM improves from 0.6776 to 0.7352, RMSE from 0.3066 to 0.2854, LPIPS from 0.2157 to 0.1699, and FID from 58.2632 to 54.1856. On SFUC, DA-Font improves over IF-Font from SSIM 0.6652 to 0.7287, RMSE 0.3280 to 0.3019, LPIPS 0.2221 to 0.1792, FID 62.8246 to 49.2237, 7 0.1213 to 0.1116, and user preference 14.60% to 17.85% (Chen et al., 20 Sep 2025).
The qualitative analysis states that DA-Font produces better structural correctness, better local detail preservation, more accurate style texture transfer, fewer missing or redundant strokes, less blurriness, and fewer artifacts. Baseline failures are described specifically: FUNIT is said to be structurally incomplete unless source and target fonts are already similar; MX-Font and LF-Font preserve rough shape but produce blurry textures; DG-Font struggles with intricate local details; CF-Font often introduces artifacts and style inconsistencies; VQ-Font is described as relatively stable but weaker in local control; IF-Font and FontDiffuser remain strong overall but still show visible stroke errors in some cases (Chen et al., 20 Sep 2025).
The ablation study attributes a large part of the performance gain to DAHM. On UFUC, the base model reports SSIM 0.6531, RMSE 0.3197, LPIPS 0.2236, and FID 60.6758. Adding the component attention block improves these to SSIM 0.7084, RMSE 0.2982, LPIPS 0.1829, and FID 57.6571. Adding both component and relation attention yields SSIM 0.7352, RMSE 0.2854, LPIPS 0.1699, and FID 54.1856. A second ablation shows that using both 8 and 9 is better than omitting either one. The paper also reports that codebook size 100 offers a good tradeoff, and that performance improves as the number of reference images increases from 1 to 4, with marginal gains beyond 4 (Chen et al., 20 Sep 2025).
The paper does not provide a dedicated failure-case section. It does, however, make clear that the reported experiments are confined to Chinese fonts, that the content font is fixed to kai, and that multilingual generalization and lightweight or real-time deployment are left for future work. This suggests that the method is currently best understood as a high-fidelity, script-specific few-shot generator rather than as a universal multilingual font system.
6. Position within the research landscape
DA-Font belongs to a line of work on few-shot font generation rather than to the line on font recognition. This distinction matters because the font literature also includes recognition systems such as DeepFont, which addressed visual font recognition with synthetic-to-real domain adaptation and large-scale font classification rather than glyph synthesis (Wang et al., 2015).
Within few-shot generation, DA-Font is closely related to several neighboring formulations but differs in its emphasis. DM-Font uses compositionality in glyph-rich scripts through a Dual Memory-augmented Font Generation Network, separating persistent memory for style-independent component priors and dynamic memory for style-specific component features (Cha et al., 2020). DS-Font reframes few-shot font generation around learning the Difference between different styles and the Similarity of the same style via a multi-layer style projector, a cluster-level contrastive style loss, and a multi-task patch discriminator (He et al., 2023). Scalable Font Reconstruction with Dual Latent Manifolds learns separate latent variables for character shape and font style in order to scale to sparse multilingual character sets and to generalize to characters not observed during training time (Srivatsan et al., 2021).
Against that background, DA-Font’s specific contribution is to make component structure an active guide for style transfer through DAHM. The component attention block uses the content-side component codebook to query style features, and the relation attention block uses content features to mediate interactions between the original and stylized component-wise representations. The paper’s interpretation is that this dual design improves both structural integrity and local fidelity, and its empirical results are presented as evidence that it outperforms state-of-the-art methods across diverse font styles and characters (Chen et al., 20 Sep 2025).
A common ambiguity in the broader literature is that the abbreviation “DA” can denote domain adaptation in recognition papers, while DA-Font denotes Dual-Attention Hybrid Integration in a generation paper. The two uses belong to different problem settings. In the present context, DA-Font refers specifically to a few-shot Chinese font generation framework whose principal innovations are DAHM, corner consistency loss, and elastic mesh feature loss.