pub struct Shaper {
typeface: FontChoice,
metrics: Metrics,
font: FontRef<'static>,
data: ShaperData,
laid_out: RefCell<LayoutCache>,
}Expand description
One typeface, shaped by harfrust and broken into rows by the desktop
engine’s rules — the whole of what TextLayout asks of a host, with no
toolkit under it.
Fields§
§typeface: FontChoice§metrics: Metrics§font: FontRef<'static>§data: ShaperDataThe parsed layout tables. Cached per face, as a layout engine caches them: building a shaper from them is cheap, parsing them is not.
laid_out: RefCell<LayoutCache>Implementations§
Source§impl Shaper
impl Shaper
Sourcepub fn new(typeface: FontChoice) -> Self
pub fn new(typeface: FontChoice) -> Self
§Panics
If the typeface’s embedded bytes are not a font this can read.
Sourcepub fn glyph_ids(&self, text: &str) -> Vec<GlyphId>
pub fn glyph_ids(&self, text: &str) -> Vec<GlyphId>
The glyphs one paragraph of text shapes to, in visual order —
identity only, for a consumer that has the positions already.
fn shape(&self, text: &str) -> Vec<Shaped>
Trait Implementations§
Source§impl TextLayout for Shaper
impl TextLayout for Shaper
Source§fn typeface(&self) -> FontChoice
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
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.Auto Trait Implementations§
impl !Freeze for Shaper
impl !RefUnwindSafe for Shaper
impl Send for Shaper
impl !Sync for Shaper
impl Unpin for Shaper
impl UnsafeUnpin for Shaper
impl UnwindSafe for Shaper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more