Skip to main content

TextLayout

Trait TextLayout 

Source
pub trait TextLayout {
    // Required methods
    fn typeface(&self) -> FontChoice;
    fn layout(&self, text: &str, font: &Font, wrap: WorldPx) -> Layout;
}
Expand description

A host’s text engine, as the exporters need to read it.

Required Methods§

Source

fn typeface(&self) -> FontChoice

The typeface this engine lays text out in. The SVG export traces its outlines from that face’s own bytes, so an engine that answered for a different one would place one font’s glyphs at another’s pen positions.

Source

fn layout(&self, text: &str, font: &Font, wrap: WorldPx) -> Layout

Lay text out in font, word-wrapped at wrap (WorldPx::UNBOUNDED for an unwrapped run). An exporter’s engine lays out at one pixel per point, so a resolution-independent format inherits no display’s DPI; the screen’s lays out at the display’s, so a mark recorded through it lands where the screen draws it.

Implementations on Foreign Types§

Source§

impl<T: TextLayout + ?Sized> TextLayout for &T

Source§

fn typeface(&self) -> FontChoice

Source§

fn layout(&self, text: &str, font: &Font, wrap: WorldPx) -> Layout

Implementors§