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
impl Zentype
Sourcepub fn new(
device: Arc<Device>,
queue: &Queue,
config: &SurfaceConfiguration,
) -> Self
pub fn new( device: Arc<Device>, queue: &Queue, config: &SurfaceConfiguration, ) -> Self
Creates a new Zentype instance with all default engines enabled.
Sourcepub fn draw(
&mut self,
queue: &Queue,
text: &str,
pos: [f32; 2],
options: &TextOptions,
) -> ShapedBuffer
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.
Sourcepub fn print(
&mut self,
queue: &Queue,
text: &str,
pos: [f32; 2],
size: f32,
color: Color,
) -> ShapedBuffer
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.
Sourcepub fn draw_rect(
&mut self,
pos: [f32; 2],
size: [f32; 2],
color: Color,
clip_rect: [f32; 4],
)
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.
Sourcepub fn hit_test(
&self,
buffer: &ShapedBuffer,
pos: [f32; 2],
options: &TextOptions,
mouse_pos: [f32; 2],
) -> usize
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.
Sourcepub fn position_at(
&self,
buffer: &ShapedBuffer,
pos: [f32; 2],
options: &TextOptions,
index: usize,
) -> Option<[f32; 2]>
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.
Sourcepub fn resize(&mut self, queue: &Queue, width: u32, height: u32)
pub fn resize(&mut self, queue: &Queue, width: u32, height: u32)
Resizes the engine’s projection to match the window dimensions.
Sourcepub fn render<'a>(&'a mut self, rpass: &mut RenderPass<'a>)
pub fn render<'a>(&'a mut self, rpass: &mut RenderPass<'a>)
Renders all accumulated text instances to the provided RenderPass.
Sourcepub fn renderer_mut(&mut self) -> &mut TextRenderer
pub fn renderer_mut(&mut self) -> &mut TextRenderer
Access the underlying renderer for advanced usage.
Sourcepub fn font_system(&self) -> Arc<Mutex<FontSystem>>
pub fn font_system(&self) -> Arc<Mutex<FontSystem>>
Access the font system used by the engine.