pub struct FontMetrics {
pub char_width: f32,
pub char_height: f32,
pub bold_char_width: f32,
pub italic_char_width: f32,
}Expand description
Font metrics for text measurement
Fields§
§char_width: f32Character width in pixels
char_height: f32Character height in pixels
bold_char_width: f32Bold character width (typically same or slightly wider)
italic_char_width: f32Italic character width (typically same)
Implementations§
Source§impl FontMetrics
impl FontMetrics
Sourcepub fn font_10x20() -> Self
pub fn font_10x20() -> Self
Create metrics for FONT_10X20
Sourcepub fn char_width_for_style(&self, style: TextStyle) -> f32
pub fn char_width_for_style(&self, style: TextStyle) -> f32
Get character width for a specific style
Sourcepub fn text_width(&self, text: &str, style: TextStyle) -> f32
pub fn text_width(&self, text: &str, style: TextStyle) -> f32
Measure text width for given style
Trait Implementations§
Source§impl Clone for FontMetrics
impl Clone for FontMetrics
Source§fn clone(&self) -> FontMetrics
fn clone(&self) -> FontMetrics
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FontMetrics
impl Debug for FontMetrics
Auto Trait Implementations§
impl Freeze for FontMetrics
impl RefUnwindSafe for FontMetrics
impl Send for FontMetrics
impl Sync for FontMetrics
impl Unpin for FontMetrics
impl UnsafeUnpin for FontMetrics
impl UnwindSafe for FontMetrics
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