pub struct Text {
Show 15 fields pub buffer: Buffer, pub pos: Vec3, pub size: Vec2, pub scale: f32, pub offsets: Vec2, pub default_color: Color, pub bounds: Option<Bounds>, pub store_id: Index, pub order: DrawOrder, pub cursor: Cursor, pub line: usize, pub scroll: Scroll, pub wrap: Wrap, pub use_camera: bool, pub changed: bool,
}

Fields§

§buffer: Buffer§pos: Vec3§size: Vec2§scale: f32§offsets: Vec2§default_color: Color§bounds: Option<Bounds>§store_id: Index§order: DrawOrder§cursor: Cursor

Cursor the shaping is set too.

§line: usize

line the shaping is set too.

§scroll: Scroll

set scroll to render too.

§wrap: Wrap

Word Wrap Type. Default is Wrap::Word.

§use_camera: bool

if the shader should render with the camera’s view.

§changed: bool

if anything got updated we need to update the buffers too.

Implementations§

source§

impl Text

source

pub fn create_quad( &mut self, cache: &mut SwashCache, atlas: &mut TextAtlas, renderer: &mut GpuRenderer ) -> Result<(), GraphicsError>

source

pub fn new( renderer: &mut GpuRenderer, metrics: Option<Metrics>, pos: Vec3, size: Vec2, scale: f32 ) -> Self

source

pub fn set_text( &mut self, renderer: &mut GpuRenderer, text: &str, attrs: Attrs<'_>, shaping: Shaping ) -> &mut Self

resets the TextRender bytes to empty for new bytes

source

pub fn set_rich_text<'r, 's, I>( &mut self, renderer: &mut GpuRenderer, spans: I, default_attr: Attrs<'_>, shaping: Shaping ) -> &mut Self
where I: IntoIterator<Item = (&'s str, Attrs<'r>)>,

resets the TextRender bytes to empty for new bytes

source

pub fn get_text_buffer(&mut self) -> &mut Buffer

For more advanced shaping and usage. Use set_changed() to set if you need it to make changes or not. This will not set the change to true. when changes are made you must set changed to true.

source

pub fn shape_until_cursor( &mut self, renderer: &mut GpuRenderer, cursor: Cursor ) -> &mut Self

cursor shaping sets the scroll.

source

pub fn shape_until( &mut self, renderer: &mut GpuRenderer, line: usize ) -> &mut Self

Line shaping does not use scroll or cursor for shaping.

source

pub fn shape_until_scroll(&mut self, renderer: &mut GpuRenderer) -> &mut Self

Does not use cursor or line but will use the last set scroll.

source

pub fn set_scroll( &mut self, renderer: &mut GpuRenderer, scroll: Scroll ) -> &mut Self

source

pub fn set_change(&mut self, changed: bool) -> &mut Self

source

pub fn set_wrap(&mut self, renderer: &mut GpuRenderer, wrap: Wrap) -> &mut Self

source

pub fn set_bounds(&mut self, bounds: Option<Bounds>) -> &mut Self

source

pub fn set_position(&mut self, position: Vec3) -> &mut Self

source

pub fn set_default_color(&mut self, color: Color) -> &mut Self

source

pub fn set_offset(&mut self, offsets: Vec2) -> &mut Self

source

pub fn set_buffer_size( &mut self, renderer: &mut GpuRenderer, width: i32, height: i32 ) -> &mut Self

source

pub fn clear(&mut self, renderer: &mut GpuRenderer) -> &mut Self

resets the TextRender bytes to empty for new bytes

source

pub fn visible_lines(&self) -> i32

returns how many lines exist in the buffer.

source

pub fn update( &mut self, cache: &mut SwashCache, atlas: &mut TextAtlas, renderer: &mut GpuRenderer ) -> Result<OrderedIndex, GraphicsError>

used to check and update the vertex array. must call build_layout before you can Call this.

source

pub fn check_mouse_bounds(&self, mouse_pos: Vec2) -> bool

source

pub fn measure(&self) -> Vec2

Auto Trait Implementations§

§

impl Freeze for Text

§

impl RefUnwindSafe for Text

§

impl Send for Text

§

impl Sync for Text

§

impl Unpin for Text

§

impl UnwindSafe for Text

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> Downcast<T> for T

source§

fn downcast(&self) -> &T

source§

impl<T> Downcast for T
where T: Any,

source§

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>

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)

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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Upcast<T> for T

source§

fn upcast(&self) -> Option<&T>

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WasmNotSend for T
where T: Send,

source§

impl<T> WasmNotSendSync for T

source§

impl<T> WasmNotSync for T
where T: Sync,