Skip to main content

Renderer

Trait Renderer 

Source
pub trait Renderer: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn render(
        &self,
        shaped: &ShapingResult,
        font: Arc<dyn FontRef>,
        params: &RenderParams,
    ) -> Result<RenderOutput>;

    // Provided methods
    fn supports_format(&self, _format: &str) -> bool { ... }
    fn clear_cache(&self) { ... }
}
Expand description

Where glyphs become visible

Rasterizers turn positioned glyphs into pixels. Vector renderers turn them into paths. Both implement this trait.

Required Methods§

Source

fn name(&self) -> &'static str

Your renderer’s signature

Source

fn render( &self, shaped: &ShapingResult, font: Arc<dyn FontRef>, params: &RenderParams, ) -> Result<RenderOutput>

Convert glyphs to visual output

Provided Methods§

Source

fn supports_format(&self, _format: &str) -> bool

Do you understand this output format?

Returns false by default - implementations should explicitly declare support.

Source

fn clear_cache(&self)

Free up rendering resources

Implementors§