pub struct Font;Implementations§
Source§impl Font
impl Font
Sourcepub fn try_metrics(
&self,
size: u16,
scale: f32,
) -> Result<BitmapFontMetrics, FontMeasureError>
pub fn try_metrics( &self, size: u16, scale: f32, ) -> Result<BitmapFontMetrics, FontMeasureError>
Validates the size and scale used by crate::draw_text_ex.
Pixel size is size as f32 * scale / 8.0, preserving the renderer’s
operation order. Zero size, nonpositive/nonfinite scale and unrepresentable
geometry return an error. Text extent is checked separately on measurement.
let font = ferravex_render::get_default_font();
assert!(font.try_metrics(0, 1.0).is_err());
assert!(font.try_metrics(16, f32::NAN).is_err());
let metrics = font.try_metrics(16, 1.5)?;
assert_eq!(metrics.measure_line("Score")?.width, 90.0);Trait Implementations§
impl Copy for Font
Auto Trait Implementations§
impl Freeze for Font
impl RefUnwindSafe for Font
impl Send for Font
impl Sync for Font
impl Unpin for Font
impl UnwindSafe for Font
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