I've been poking at the Rust font stack for the past few days. I'm going to probably end up using the fontations stack as well as HarfRust to handle a good amount of my text woes. But that still leaves the problem of rasterization. The freetype library has its own rasterizer but this has been omitted from skrifa.
I'm guessing this is because rasterization can be done so many different ways, using SDFs, the CPU, GPU, or a mix of all three. But for my case I just need something simple to render fonts to bitmap buffers.
At the moment the two options for purely rasterization seem to be tiny-skia and vello_cpu. Is there anything else out there? Am I missing something important?
Since you already have outlines from skrifa, the smallest thing you can add is zeno — it's just a path rasterizer (no font parsing, basically no deps) and it's what swash uses underneath. Feed it the glyph outline, get back a coverage mask, done.
If you want hinting, use swash and its scale module instead: same zeno underneath but it does TrueType hinting, bitmap strikes, and can emit SDFs. It's the only one in this list that hints; tiny-skia, vello_cpu, zeno and ab_glyph_rasterizer are all unhinted AA.
ab_glyph_rasterizer is the other "only a rasterizer" crate — very small, 40M downloads, used by the ab_glyph / glyph_brush family. fontdue is simplest API-wise but parses fonts itself, so it would duplicate what skrifa is already doing for you.
For "render text to a bitmap buffer" with the stack you describe I'd go skrifa → zeno, and move up to swash's scaler the day hinting starts to matter.
Edit: To clarify, I appreciate the offer of help. But I am looking for the opinions of developers experienced in this field, not general overviews that AI produces. Sincerely thanks for the help though.
it does have rasterization, but I reckon it's probably way more heavy-weight than what you wanted. the api looks neat though, here's the example from their documentation:
let glyph = font.rasterize_glyph(gid, 32.0, &[]).expect("has ink");
glyph.metrics.width; // usize
glyph.metrics.height; // usize
glyph.metrics.xmin; // i32, left edge in device pixels
glyph.metrics.advance_width; // f32, already in pixels
glyph.bitmap; // Vec<u8>, one coverage byte per pixel
Thanks for the link, unfortunately the project's heavy reliance on AI means I'm not too interested.
I've gotten two AI-driven responses to this thread saying only swash does hinting, but it would be really nice if someone with domain knowledge could confirm this. Before I even wrote the OP I had a look through skrifa and it seems to support hinting, so it seems wrong or misleading at best as an answer.
Thanks for the response! AFAIK ttf-parser is unmaintained, rustybuzz is unmaintained and swash isn't actively worked on any more. I'm a bit hesitant on pulling in C libraries, I already do that for SDL3 and it's kind of a headache.
I think I'm going to end up using parley for layout and some other features I need anyway (breaking, IME handling, accessibility) and use tiny_skia for rasterization to a texture atlas for OpenGL rendering. I guess I'll update the post when I have a firmer conclusion.