pub struct TextSystem { /* private fields */ }Expand description
The font and layout contexts a thread lays text out with.
One system per thread keeps parley’s non-Send contexts out of shared
state. The system is inert state: creating, replacing or dropping one
touches nothing but this thread.
Implementations§
Source§impl TextSystem
impl TextSystem
Sourcepub fn bundled_only() -> TextSystem
pub fn bundled_only() -> TextSystem
Creates a system that sees only the bundled fonts.
Without the bundled-fonts feature the system starts empty and every
glyph lays out as missing.
Sourcepub fn with_system_fonts() -> TextSystem
pub fn with_system_fonts() -> TextSystem
Creates a system that sees the system fonts plus the bundled ones as a fallback.
System fonts are discovered only when the system-fonts feature is
enabled, which is impossible on wasm. Without it this behaves like
TextSystem::bundled_only.
Sourcepub fn install(self)
pub fn install(self)
Installs this system for the current thread, replacing whatever the thread owned before.
§Panics
Panics if the thread’s system is in use, because a system cannot be replaced while a layout borrows it.
Sourcepub fn with<R>(f: impl FnOnce(&mut TextSystem) -> R) -> R
pub fn with<R>(f: impl FnOnce(&mut TextSystem) -> R) -> R
Runs f with the current thread’s system, creating one on first use:
TextSystem::with_system_fonts on native targets and
TextSystem::bundled_only on wasm.
§Panics
Panics if called from inside another with call on the same thread,
for example from a crate::TextLayout constructor, because a system
cannot be handed out twice at once.
Auto Trait Implementations§
impl !Freeze for TextSystem
impl !RefUnwindSafe for TextSystem
impl !UnwindSafe for TextSystem
impl Forget for TextSystem
impl Move for TextSystem
impl Send for TextSystem
impl Sync for TextSystem
impl Unpin for TextSystem
impl UnsafeUnpin for TextSystem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.