Skip to content

[Research] Add bezier-curve SDF generation via ttf-parser (research branch for #16)#27

Draft
lseelenbinder wants to merge 2 commits into
mainfrom
claude/sdf-font-tools-plan-eS2ED
Draft

[Research] Add bezier-curve SDF generation via ttf-parser (research branch for #16)#27
lseelenbinder wants to merge 2 commits into
mainfrom
claude/sdf-font-tools-plan-eS2ED

Conversation

@lseelenbinder

Copy link
Copy Markdown
Member

Add an alternative vector-based SDF generation path that computes signed distance fields directly from font bezier curve outlines, rather than from rasterized bitmaps. This improves rendering quality for complex scripts (Indic, Khmer, Burmese) where rasterization loses information.

New modules in sdf_glyph_renderer:

  • outline.rs: Glyph outline data structures with bezier curve flattening
  • outline_sdf.rs: SDF algorithm using R-tree spatial indexing + winding number
  • ttf.rs: ttf-parser integration via OutlineBuilder trait
  • types.rs: Shared SdfGlyph/GlyphMetrics types (extracted from ft.rs)

New in pbf_font_tools:

  • ttf_generate.rs: ttf-parser glyph generation pipeline (parallel to ft_generate.rs)

CLI changes:

  • build_pbf_glyphs --backend bitmap|bezier flag to select SDF generation method

New dependencies: ttf-parser (pure Rust font parser), rstar (R-tree spatial index) Both gated behind the "ttf-parser" feature flag.

https://claude.ai/code/session_01MZQnJnULX397TRkQ6vpJms

Add an alternative vector-based SDF generation path that computes signed
distance fields directly from font bezier curve outlines, rather than
from rasterized bitmaps. This improves rendering quality for complex
scripts (Indic, Khmer, Burmese) where rasterization loses information.

New modules in sdf_glyph_renderer:
- outline.rs: Glyph outline data structures with bezier curve flattening
- outline_sdf.rs: SDF algorithm using R-tree spatial indexing + winding number
- ttf.rs: ttf-parser integration via OutlineBuilder trait
- types.rs: Shared SdfGlyph/GlyphMetrics types (extracted from ft.rs)

New in pbf_font_tools:
- ttf_generate.rs: ttf-parser glyph generation pipeline (parallel to ft_generate.rs)

CLI changes:
- build_pbf_glyphs --backend bitmap|bezier flag to select SDF generation method

New dependencies: ttf-parser (pure Rust font parser), rstar (R-tree spatial index)
Both gated behind the "ttf-parser" feature flag.

https://claude.ai/code/session_01MZQnJnULX397TRkQ6vpJms
@lseelenbinder
lseelenbinder force-pushed the claude/sdf-font-tools-plan-eS2ED branch from a7c841d to eeff6de Compare March 13, 2026 10:22
The two modules were tightly coupled (outline_sdf only operated on types
from outline). Combining them removes a module boundary and the
cross-module imports, keeping all outline geometry + SDF rendering in
one place.

https://claude.ai/code/session_01MZQnJnULX397TRkQ6vpJms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants