Few-shot Font Generation aims to generate stylistically consistent glyphs from a few reference glyphs. However, capturing complex font styles from a few exemplars remains challenging, and the existing methods often struggle to retain discernible local characteristics in generated samples. This paper introduces DRG-Font, a contrastive font generation strategy that learns complex glyph attributes by decomposing style and content embedding spaces. For optimal style supervision, the proposed architecture incorporates a Reference Selection (RS) Module to dynamically select the best style reference from an available pool of candidates. The network learns to decompose glyph attributes into style and shape priors through a Multi-scale Style Head Block (MSHB) and a Multi-scale Content Head Block (MCHB). For style adaptation, a Multi-Fusion Upsampling Block (MFUB) produces the target glyph by combining the reference style prior and target content prior. The proposed method demonstrates significant improvements over state-of-the-art approaches across multiple visual and analytical benchmarks.
Figures & tables
Figure 2: An overview of the proposed DRG-Font. The initial reference selection is performed by the RS Module, which finds the optimal style reference xs from an available set of candidates, such that xs is structurally closest to the given content reference xc . The Generator network independently encodes xs and xc by using Esc , producing the style and content embeddings from both references. The target glyph y^ is generated by Dsc through a cross-fusion of the embeddings. The discriminator network enforces adversarial guidance by auxiliary style and content classification. The Stable Diffusion Encoder (SDv2 Enc) [ 30 ] is used to ensure high-quality latent reconstruction.
Figure 3: Architecture of the proposed Style-Content Encoder Esc . The input image xα passes through four consecutive Down2x Blocks. The resulting feature maps then pass through the Multiscale Style Head Block (MSHB) and the Multiscale Content Head Block (MCHB) in parallel. Both MSHB and MCHB encode three latent embeddings using three different heads, which are finally concatenated to produce the style embedding eαstyle (from MSHB) and the content embedding eαcontent (from MCHB).
Figure 4: Architecture of the proposed Style-Content Decoder Dsc . The network uses a Multi-Fusion Upsampling Block (MFUB) to generate the target image y^ by combining the multiscale style embeddings esstyle=⟨es,1style,es,2style,es,3style⟩ from MSHB and content embedding eccontent from MCHB.
Figure 5: Qualitative comparison results on Unseen English and Seen English fonts. Boxes marked in red highlight issues like failure of style adaptation, structural deformation, and missing strokes. Boxes marked in blue highlight issues like minor appearance of artifacts and minor structural inconsistencies.
Figure 6: Qualitative comparison results on Unseen Chinese and Seen Chinese fonts. Boxes marked in red highlight issues like failure of style adaptation, structural deformation, and missing strokes. Boxes marked in blue highlight issues like minor appearance of artifacts and minor structural inconsistencies.
Unseen English
Seen English
Method
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
User Study ↑
FANNET [ 31 ]
0.077
0.239
0.731
0.185
0.078
0.238
0.779
0.116
10.789
MA-Font [ 28 ]
0.089
0.272
0.694
0.143
0.087
0.269
0.712
0.138
6.710
PatchFont [ 22 ]
0.098
0.266
0.675
0.143
0.100
0.281
0.680
0.143
5.657
FASTER [ 8 ]
0.075
0.246
0.723
0.139
0.077
0.239
0.731
0.138
7.894
DA-Font [ 4 ]
0.074
0.243
0.713
0.111
0.069
0.223
0.775
0.084
15.526
Table 1: Quantitative comparison of the proposed method with the existing state-of-the-art techniques on Unseen English and Seen English fonts. The best scores are shown in bold and the second best scores are underlined .
Unseen Chinese
Seen Chinese
Method
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
User Study ↑
FANNET [ 31 ]
0.161
0.347
0.449
0.289
0.147
0.334
0.502
0.291
2.105
MA-Font [ 28 ]
0.176
0.374
0.430
0.150
0.172
0.372
0.456
0.160
9.605
PatchFont [ 22 ]
0.251
0.442
0.288
0.224
0.225
0.420
0.353
0.204
3.158
FASTER [ 8 ]
0.197
0.339
0.458
0.160
0.093
0.297
0.484
0.166
8.421
DA-Font [ 4 ]
0.166
0.357
0.469
0.143
0.125
0.303
0.603
0.107
21.053
Table 2: Quantitative comparison of the proposed method with the existing state-of-the-art techniques on Unseen Chinese and Seen Chinese fonts. The best scores are shown in bold and the second best scores are underlined .
Figure 7: Qualitative comparison of the generation quality with and without (in both train and test phases) incorporating the RS Module into the proposed pipeline.
RS Module
Metrics
Training
Testing
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
✗
✗
0.098
0.287
0.676
0.167
✗
✓
0.085
0.266
0.699
0.141
✓
✗
0.081
0.256
0.713
0.129
✓
✓
0.072
0.237
0.739
0.108
Table 3: Quantitative analysis of the impact of the RS Module on the generation quality.
Loss Function
Metrics
Lcls
Llatent
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
✗
✗
0.074
0.243
0.730
0.113
✗
✓
0.073
0.240
0.736
0.108
✓
✗
0.075
0.244
0.729
0.114
✓
✓
0.072
0.237
0.739
0.108
Table 4: Quantitative analysis of the effectiveness of Lcls and Llatent on the generation quality.
Head Dimension
L1 ↓
RMSE ↓
SSIM ↑
LPIPS ↓
128
0.074
0.241
0.734
0.108
256
0.072
0.237
0.739
0.108
512
0.074
0.241
0.734
0.111
Table 5: Quantitative analysis of the effect of embedding dimension of each head ( ∈R3d ) on the generation quality.
State Key Laboratory for Novel Software Technology, Nanjing University, China · School of Artificial Intelligence, Nanjing University, China · Department of Computer Science and Technology, Nanjing University, China +1