Add skrifa + vello_cpu font rendering backend#91
Open
torokati44 wants to merge 4 commits intoPolyMeilex:masterfrom
Open
Add skrifa + vello_cpu font rendering backend#91torokati44 wants to merge 4 commits intoPolyMeilex:masterfrom
torokati44 wants to merge 4 commits intoPolyMeilex:masterfrom
Conversation
Add a `skrifa` feature flag as an alternative font rendering backend using skrifa for font parsing/metrics/outlines and vello_cpu for rasterization. Priority order when multiple features are enabled: crossfont > skrifa > ab_glyph > dumb (no text) Usage: --features skrifa
Test the rendering pipeline using the bundled Cantarell font: - renders_non_empty_pixmap: verifies output has non-zero dimensions - renders_pixels_with_coverage: confirms glyphs produce visible pixels - empty_title_returns_none: no pixmap for empty string - update_scale_changes_size: scaling produces wider output - update_color_rerenders: color change produces different pixels - parse_bundled_font_succeeds: Cantarell parses with valid metrics Run with: cargo test --no-default-features --features skrifa
Use HintingInstance with default options (Engine::AutoFallback, SmoothMode::Normal) to apply hinting when drawing glyph outlines. Falls back gracefully to unhinted rendering if the font doesn't support it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #90.
If you'd like, I can drop the commit that adds the unit tests - they seem a bit superfluous. And then the other three commits could even be squashed into one.
The dependency versions were chosen to match the ones in egui just before their updating to
wgpu29: https://github.com/emilk/egui/blob/b077cf910297884a4f1b431e8da99806ae925168/Cargo.toml#L128-L140This is somewhat in self-interest, because of ruffle-rs/ruffle#23274.
I don't know your (or this project's) stance on AI in general, but full disclaimer: This whole thing was generated by an LLM-powered coding agent. I have read through all of it with my own human eyes though, and nothing stood out as particularly problematic. It's also similar in size as the other two backends, and what it does is fairly straightforward.
Also I have tested it manually, and it does indeed appear to work just fine.