pub struct BitmapTextMetrics {
pub width: f32,
pub height: f32,
pub line_count: usize,
pub unsupported_glyphs: usize,
pub ink_bounds: Option<Rect>,
}Expand description
Logical size and tight visible bounds of a measured label.
let metrics = ferravex_render::get_default_font().try_metrics(8, 1.0)?;
let text = metrics.measure_line("A ")?;
assert_eq!((text.width, text.height, text.line_count), (12.0, 7.0, 1));
assert_eq!(text.ink_bounds, Some(ferravex_render::Rect::new(0.0, 0.0, 5.0, 7.0)));Fields§
§width: f32Maximum line advance, including the final one-pixel gap and blank cells.
Advances accumulate in the same order as draw_text_ex at local X = 0.
height: f32Distance from the first line’s top to the last line’s baseline. Empty input has zero height; explicit blank lines reserve their height.
line_count: usizeNumber of logical lines, including trailing blank lines. Empty input is zero.
unsupported_glyphs: usizeNumber of unsupported Unicode scalar values, excluding ordinary spaces
and the line separators recognized by measure_multiline.
ink_bounds: Option<Rect>Tight union of the glyph rectangles relative to the first line’s top-left.
None means no visible glyph pixels, even when logical size is nonzero.
Trait Implementations§
Source§impl Clone for BitmapTextMetrics
impl Clone for BitmapTextMetrics
Source§fn clone(&self) -> BitmapTextMetrics
fn clone(&self) -> BitmapTextMetrics
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 BitmapTextMetrics
impl Debug for BitmapTextMetrics
Source§impl Default for BitmapTextMetrics
impl Default for BitmapTextMetrics
Source§fn default() -> BitmapTextMetrics
fn default() -> BitmapTextMetrics
Returns the “default value” for a type. Read more
Source§impl PartialEq for BitmapTextMetrics
impl PartialEq for BitmapTextMetrics
impl Copy for BitmapTextMetrics
impl StructuralPartialEq for BitmapTextMetrics
Auto Trait Implementations§
impl Freeze for BitmapTextMetrics
impl RefUnwindSafe for BitmapTextMetrics
impl Send for BitmapTextMetrics
impl Sync for BitmapTextMetrics
impl Unpin for BitmapTextMetrics
impl UnwindSafe for BitmapTextMetrics
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