VecFontSDF: SDF-Based Vector Font Reconstruction
- VecFontSDF is an end-to-end framework that models glyphs with signed distance functions and implicit shape representations to produce high-quality vector fonts.
- The method uses parabolic primitive pseudo-distance functions and a conversion to quadratic Bézier curves, ensuring compatibility with formats like SVG and TTF.
- Empirical evaluations demonstrate that VecFontSDF outperforms prior methods in reconstruction accuracy, interpolation, and few-shot vector font synthesis.
VecFontSDF is an end-to-end trainable framework for reconstructing and synthesizing high-quality vector fonts using signed distance functions (SDFs) and SDF-based implicit shape representations. Unlike prior works focused predominantly on raster image font generation, VecFontSDF learns to model each glyph as a composition of shape primitives enclosed by parabolic curves that are amenable to analytical conversion into quadratic Bézier curves. This capability yields outputs directly compatible with prevalent vector font formats such as SVG and TTF, facilitating direct application in digital content and printing workflows. Extensive qualitative and quantitative evaluations demonstrate that VecFontSDF substantially surpasses previous methods in vector font reconstruction, interpolation, and few-shot vector font synthesis tasks (Xia et al., 2023).
1. Implicit Signed Distance Function Representation
Glyphs in VecFontSDF are represented as a collection of closed contours, each composed of quadratic Bézier curves parameterized as
where and are on-curve endpoints and the off-curve control point. For supervision, the method generates a target SDF for each glyph by computing the distance from a point to its nearest Bézier segment. This process involves solving for the parameter and then computing the signed distance using the direction of the Bézier derivative. Target SDFs are generated both on the uniform image grid ("grid SDF") and by dense sampling near glyph contours ("contour SDF").
2. Parabolic Primitive Pseudo-Distance Functions
Practical end-to-end learning precludes direct backpropagation through the analytic SDF computation. To circumvent this, VecFontSDF approximates glyphs as the intersection of shape primitives. Each primitive is defined as the union of implicit parabolic arcs parameterized as
with the pseudo-distance to an arc in primitive 0 given by
1
The primitive’s signed distance is 2, and the overall glyph SDF is 3, so that 4 indicates point inclusion in the glyph region. This formulation enables differentiable training while allowing the model to recover meaningful, compact vector outlines.
3. Conversion to Quadratic Bézier Curves
At inference, each implicit parabolic arc is analytically converted to a quadratic Bézier segment to ensure compatibility with standard font engines. The process identifies intersection points of the arc with the primitive boundary, assigns them to 5 and 6, then sets the control point 7 via a closed formula involving the primitive parameters. The full glyph outline is produced by repeating this conversion across all parabolic primitives and merging the resulting segments into closed contours. This direct conversion distinguishes VecFontSDF from earlier SDF approaches that do not yield Bézier-compatible outputs or require thousands of control points.
4. Network Architecture and Training Objectives
VecFontSDF's architecture comprises a ResNet-18 encoder (LeakyReLU, BatchNorm) that maps an input 8 glyph image 9 to a 512-dimensional feature vector 0. The SDF decoder consists of two fully connected layers and a ReLU nonlinearity, predicting the parameters 1 with 2 and 3. The pseudo-SDF module evaluates 4 over the image domain.
A differentiable renderer applies a smooth step function to 5 to produce a reconstructed raster image, parameterized by a learnable threshold 6. Training optimizes a total loss,
7
where 8 is raster image reconstruction, 9 and 0 enforce SDF consistency, and 1 regularizes parameter constraints such as 2 and minimum 3. The loss weights are fixed as 4 and 5.
5. Empirical Evaluation and Comparison
Experiments utilize 1,116 publicly available fonts (O’Donovan et al.), with 6 train/test split and glyphs rasterized at 7 resolution. Evaluation metrics include 8 pixel error, IoU, PSNR, LPIPS, and SSIM. VecFontSDF achieves 9, IoU 0, PSNR 1 dB, LPIPS 2, and SSIM 3, markedly outperforming prior SDF baselines BSP-Net and IGSR, which obtain 4 and IoU 5. Ablation studies reveal that removing grid/contour SDF losses significantly degrades reconstruction accuracy.
The method supports linear interpolation in the latent 6-space, enabling smooth morphing between font styles and the synthesis of novel vector glyphs. In few-shot font style transfer, a dual-encoder (for style and content) and UNet decoder first predict an intermediate glyph image, which VecFontSDF then reconstructs as an SDF and Bézier outline. With only four style references in raster form, VecFontSDF surpasses DeepVecFont, which requires vector/raster modalities and offline refinement for similar tasks. The outlines produced are distortion-free and concise.
6. Qualitative Assessment and Limitations
VecFontSDF exhibits strong fidelity in reproducing serifs, concave loops, and thin strokes, representing glyphs with tens rather than thousands of Bézier segments. Prior SDF-based methods—BSP-Net, IGSR, Im2Vec, and multi-implicits—are limited in this regard, resulting in jagged edges, rounded corners, or exceedingly large numbers of control points and lacking direct compatibility with quadratic Bézier-based font specifications. However, for highly irregular or heavily disconnected cursive shapes (e.g., G, S, cursive f, N), the fixed number of primitives can become a limiting factor, thereby reducing reconstruction accuracy for such glyphs.
7. Future Directions
Ongoing research directions highlighted include incorporating richer network backbones, adopting adaptive or dynamic numbers of parabolic primitives per glyph, and extending pseudo-distance functions to more expressive higher-order curves such as cubics. These enhancements aim to further improve generalization, reconstruction capacity for complex scripts, and applicability to broader classes of vector graphics (Xia et al., 2023).