Skip to main content

Zentype

Struct Zentype 

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

The “Zero-Config” entry point for the Zentype engine.

This managed API handles the entire lifecycle of font shaping, rasterization, and GPU atlas management internally.

Implementations§

Source§

impl Zentype

Source

pub fn new( device: Arc<Device>, queue: &Queue, config: &SurfaceConfiguration, ) -> Self

Creates a new Zentype instance with all default engines enabled.

Source

pub fn draw( &mut self, queue: &Queue, text: &str, pos: [f32; 2], options: &TextOptions, ) -> ShapedBuffer

Prepares text for drawing in the current frame at the specified position. Returns the ShapedBuffer for interactivity.

Source

pub fn print( &mut self, queue: &Queue, text: &str, pos: [f32; 2], size: f32, color: Color, ) -> ShapedBuffer

A convenience method for printing simple text labels.

Source

pub fn draw_rect( &mut self, pos: [f32; 2], size: [f32; 2], color: Color, clip_rect: [f32; 4], )

Draws a solid colored rectangle with optional clipping. Perfect for cursors, underlines, or selection highlights.

Source

pub fn hit_test( &self, buffer: &ShapedBuffer, pos: [f32; 2], options: &TextOptions, mouse_pos: [f32; 2], ) -> usize

Finds the character index at the given screen-space coordinates for a specific buffer.

Source

pub fn position_at( &self, buffer: &ShapedBuffer, pos: [f32; 2], options: &TextOptions, index: usize, ) -> Option<[f32; 2]>

Returns the screen-space position for a given character index in a specific buffer.

Source

pub fn resize(&mut self, queue: &Queue, width: u32, height: u32)

Resizes the engine’s projection to match the window dimensions.

Source

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

Renders all accumulated text instances to the provided RenderPass.

Source

pub fn renderer_mut(&mut self) -> &mut TextRenderer

Access the underlying renderer for advanced usage.

Source

pub fn font_system(&self) -> Arc<Mutex<FontSystem>>

Access the font system used by the engine.

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

Source§

fn downcast(&self) -> &T

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

impl<T> Upcast<T> for T

Source§

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

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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