← Todos los crates de Fission

fission-render-vello

Vello GPU and CPU renderer backends for Fission display lists
0.16.0 · android · ios · linux · macos · windows · web
Ver paquetes publicados en crates.io
Repositorio del código

fission-render-vello

Vello rendering backend for the Fission UI framework.
fission-render-vello is the primary GPU rendering backend for Fission. It implements theRenderer trait by translating DisplayList operations into a Vello Scene graph, which is then rasterized on the GPU via wgpu. Text shaping and layout are handled byParley through the VelloTextMeasurer, which also implements the TextMeasurer trait for the layout engine. The crate includes caches for text layouts (simple and rich), decoded images, and parsed SVG paths to keep frame times low.

Key types

Type
Description
VelloRenderer<'a>
Implements fission_render::Renderer. Writes display ops into a Vello Scene using the current affine transform stack. Handles rectangles, text, rich text (with per-run styling and background highlights), images, SVG paths, inline SVG, and box shadows.
VelloTextMeasurer
Implements fission_layout::TextMeasurer. Wraps a Parley FontContext and LayoutContext with an LRU-style layout cache (4096 simple entries, 2048 rich entries). Provides measure, measure_rich_text, hit_test, get_line_metrics, and get_caret_position.
ParleyBrush
A simple [u8; 4] RGBA brush type used as the generic parameter for parley::layout::Layout.

Supported display ops

•
DrawRect with fill, stroke, rounded corners, and box shadow
•
DrawText with font size, color, underline, and optional caret rendering
•
DrawRichText with per-run font size, color, underline, and background highlight
•
DrawImage with Fill, Contain, Cover, and None fit modes (image cache)
•
DrawPath from SVG path data
•
DrawSvg with viewBox-aware scaling and fill/stroke (SVG parse cache)
•
DrawSurface (video surface placeholder)
•
Save / Restore / ClipRect / ClipRoundedRect / Translate / Transform

Web font fallback

The Web renderer uses Parley for layout and shaping. Browser builds cannot enumerate fonts installed on the user's device, so a missing glyph would otherwise become a tofu box. When a Web text run contains a missing glyph, Fission rasterizes that run with Canvas 2D and the browser's own font fallback stack, then paints the resulting image in the Vello scene. This lets installed CJK and emoji fonts work without embedding large fallback files in every app. The fallback image uses the width and vertical metrics already assigned by Parley and is cached for reuse across frames.

Usage example

use fission_render_vello::{VelloRenderer, VelloTextMeasurer};
use parley::FontContext;
use std::sync::{Arc, Mutex};
use vello::Scene;

// Set up text measurement
let font_cx = Arc::new(Mutex::new(FontContext::new()));
let measurer = Arc::new(VelloTextMeasurer::new(font_cx));

// Render a frame
let mut scene = Scene::new();
let mut renderer = VelloRenderer::new(&mut scene, measurer, 2.0 /* scale factor */);
renderer.render(&display_list)?;
// `scene` is now ready to be submitted to a Vello `Renderer` backed by wgpu.

Status

Supported -- this is the default and recommended rendering backend for Fission on desktop. Used in production by fission-shell-desktop.

License

Apache-2.0 -- see the Fission repository for full documentation at https://fission.rs.