Skip to main content

TextLayer

Struct TextLayer 

Source
pub struct TextLayer { /* private fields */ }
Expand description

Owns glyphon’s font/atlas/renderer state plus a reusable buffer pool, and the per-frame queue of runs. One instance per super::Renderer.

Implementations§

Source§

impl TextLayer

Source

pub fn new(device: &Device, queue: &Queue, format: TextureFormat) -> Self

Build the text layer on device, targeting format (the surface format). Loads the system font set once here, not per frame.

Source

pub fn queue(&mut self, runs: &[TextRun<'_>])

Replace this frame’s queued runs with owning copies of runs.

Source

pub fn push(&mut self, run: TextRun<'_>)

Append one run to this frame’s queue, leaving what is already there alone. The core’s own furniture — the now-playing banner (ADR-0110) — goes in through this rather than queue, which replaces: a frontend that queues nothing this frame must not erase it.

Source

pub fn prepare( &mut self, device: &Device, queue: &Queue, width: u32, height: u32, ) -> bool

Shape the queued runs and upload their glyphs to the atlas. Returns whether there is anything to draw; an atlas-full or shaping failure degrades to “nothing drawn” rather than panicking on the render path.

Source

pub fn render<'pass>(&'pass self, pass: &mut RenderPass<'pass>)

Draw the prepared runs into pass (a load pass over the scene). No-op if prepare produced nothing drawable.

Source

pub fn end_frame(&mut self)

End-of-frame housekeeping: free atlas space unused this frame and clear the queue for the next one.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

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

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

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