chore: switch freetype to swash#33
Conversation
There was a problem hiding this comment.
Pull request overview
This PR replaces the FreeType-based glyph rasterization path with a Swash-based Rust font renderer, updating feature flags, public APIs, docs, tests, and CI accordingly.
Changes:
- Replace
freetype-gated rendering with a newfontmodule built onswash(FontFace/FontRenderer). - Rename
pbf_font_tools’ glyph-generation feature togenerateand update glyph generation code + integration test expectations. - Update workspace dependencies and CI/publish workflows to remove FreeType and use the new feature flags.
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| sdf_glyph_renderer/src/lib.rs | Switch feature-gated module wiring from ft/FreeType to font/Swash. |
| sdf_glyph_renderer/src/ft.rs | Remove the old FreeType-based rendering implementation. |
| sdf_glyph_renderer/src/font.rs | Add Swash-based font loading and glyph rasterization to bitmap/SDF. |
| sdf_glyph_renderer/src/error.rs | Replace FreeType error variants with font-data/glyph-missing errors under font. |
| sdf_glyph_renderer/README.md | Update documentation to describe the new font feature and remove FreeType references. |
| sdf_glyph_renderer/Cargo.toml | Swap dependency from freetype-rs to optional swash; set default feature to font. |
| pbf_font_tools/tests/integration_tests.rs | Update test gating and assertions for Swash-based generation behavior. |
| pbf_font_tools/src/lib.rs | Rename/repoint generation module and re-exports from FreeType to FontFace. |
| pbf_font_tools/src/font_generate.rs | Rework glyph generation to use FontFace + FontRenderer instead of FreeType faces. |
| pbf_font_tools/src/error.rs | Remove FreeType error plumbing; gate SDF glyph errors behind generate. |
| pbf_font_tools/README.md | Update feature docs from FreeType to generate (font-file generation). |
| pbf_font_tools/Cargo.toml | Replace freetype* features with generate and make it default. |
| Cargo.toml | Remove freetype-rs workspace dep and add swash. |
| Cargo.lock | Update lockfile for Swash + transitive dependencies; remove FreeType stack. |
| build_pbf_glyphs/src/main.rs | Switch CLI font loading from FreeType to FontFace with shared Arc<[u8]> data. |
| build_pbf_glyphs/README.md | Remove FreeType bundling/build notes. |
| build_pbf_glyphs/Cargo.toml | Update dependency feature from freetype to generate. |
| .github/workflows/publish.yml | Update publish feature flags from freetype to font/generate. |
| .github/workflows/ci.yml | Remove explicit --features freetype usage and Windows/FreeType workarounds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
This is interesting! I have never heard of this dependency before so I'll want to check it out first. While I agree with the spirit of #32 (I don't want the C deps either; they're a headache!), I am not quite sure if this is the correct approach. In #16, I mention a few crates that would not only get us to Rust, but also result in better renders. I think we should probably solve for that first, and freetype will naturally fall away. There's an open PR where @lseelenbinder threw Claude Code at it for fun a few months ago, but I think that was the web-based version which has crappy capabilities compared to running via the app/CLI locally on max effort. Feel free to take a stab at it if you like. |
fixes #32
Note that I have not actually had a chance to study the results in depth to see if the conversion is what is desired vs older stack