pub struct TextBlock {
pub spans: Vec<TextSpan>,
pub position: Vec3,
pub char_width: f32,
pub char_height: f32,
pub max_width: Option<f32>,
pub align: TextAlign,
pub baseline: TextBaseline,
pub layer: RenderLayer,
pub blend: BlendMode,
pub visible: bool,
pub z_offset: f32,
}Expand description
A laid-out block of text. Position is the top-left corner in world/screen space.
Fields§
§spans: Vec<TextSpan>§position: Vec3§char_width: f32§char_height: f32§max_width: Option<f32>§align: TextAlign§baseline: TextBaseline§layer: RenderLayer§blend: BlendMode§visible: bool§z_offset: f32Implementations§
Source§impl TextBlock
impl TextBlock
pub fn new(text: &str, position: Vec3) -> Self
pub fn rich(markup: &str, position: Vec3) -> Self
pub fn with_color(self, c: Vec4) -> Self
pub fn with_scale(self, w: f32, h: f32) -> Self
pub fn with_align(self, a: TextAlign) -> Self
pub fn with_max_width(self, w: f32) -> Self
pub fn with_layer(self, l: RenderLayer) -> Self
Sourcepub fn layout(&self) -> Vec<CharLayout>
pub fn layout(&self) -> Vec<CharLayout>
Lay out characters into positions. Returns (char, Vec3, Vec4, f32_emission) tuples.
Sourcepub fn spawn_into(&self, pool: &mut GlyphPool) -> Vec<GlyphId>
pub fn spawn_into(&self, pool: &mut GlyphPool) -> Vec<GlyphId>
Spawn all characters into a GlyphPool.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TextBlock
impl RefUnwindSafe for TextBlock
impl Send for TextBlock
impl Sync for TextBlock
impl Unpin for TextBlock
impl UnsafeUnpin for TextBlock
impl UnwindSafe for TextBlock
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.