pub struct TextRenderer;Expand description
Text renderer with cached font
Implementations§
Source§impl TextRenderer
impl TextRenderer
Sourcepub fn font(weight: FontWeight) -> &'static Font
pub fn font(weight: FontWeight) -> &'static Font
Get a font for the specified weight
Sourcepub fn render_text(
pixmap: &mut Pixmap,
text: &str,
x: f32,
y: f32,
size: f32,
color: Color,
)
pub fn render_text( pixmap: &mut Pixmap, text: &str, x: f32, y: f32, size: f32, color: Color, )
Render text to a pixmap at the given position
Sourcepub fn render_text_weighted(
pixmap: &mut Pixmap,
text: &str,
x: f32,
y: f32,
size: f32,
color: Color,
weight: FontWeight,
)
pub fn render_text_weighted( pixmap: &mut Pixmap, text: &str, x: f32, y: f32, size: f32, color: Color, weight: FontWeight, )
Render text with a specific font weight
Sourcepub fn measure_text(text: &str, size: f32) -> f32
pub fn measure_text(text: &str, size: f32) -> f32
Measure the width of text
Sourcepub fn measure_text_weighted(text: &str, size: f32, weight: FontWeight) -> f32
pub fn measure_text_weighted(text: &str, size: f32, weight: FontWeight) -> f32
Measure the width of text with a specific font weight
Sourcepub fn line_height(size: f32) -> f32
pub fn line_height(size: f32) -> f32
Get the total line height for a font size
Auto Trait Implementations§
impl Freeze for TextRenderer
impl RefUnwindSafe for TextRenderer
impl Send for TextRenderer
impl Sync for TextRenderer
impl Unpin for TextRenderer
impl UnwindSafe for TextRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
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.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.§fn as_any(&self) -> &(dyn Any + 'static)
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.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.