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
impl TextLayer
Sourcepub fn new(device: &Device, queue: &Queue, format: TextureFormat) -> Self
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.
Sourcepub fn queue(&mut self, runs: &[TextRun<'_>])
pub fn queue(&mut self, runs: &[TextRun<'_>])
Replace this frame’s queued runs with owning copies of runs.
Sourcepub fn push(&mut self, run: TextRun<'_>)
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.
Sourcepub fn prepare(
&mut self,
device: &Device,
queue: &Queue,
width: u32,
height: u32,
) -> bool
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.