pub struct Size(Option<f32>);
Expand description
Font size in pixels per em units.
Sizes in this crate are represented as a ratio of pixels to the size of
the em square defined by the font. This is equivalent to the px
unit
in CSS (assuming a DPI scale factor of 1.0).
To retrieve metrics and outlines in font units, use the unscaled constructor on this type.
Tuple Fields§
§0: Option<f32>
Implementations§
Source§impl Size
impl Size
Sourcepub fn new(ppem: f32) -> Self
pub fn new(ppem: f32) -> Self
Creates a new font size from the given value in pixels per em units.
Sourcepub fn unscaled() -> Self
pub fn unscaled() -> Self
Creates a new font size for generating unscaled metrics or outlines in font units.
Sourcepub fn ppem(self) -> Option<f32>
pub fn ppem(self) -> Option<f32>
Returns the raw size in pixels per em units.
Results in None
if the size is unscaled.
Sourcepub fn linear_scale(self, units_per_em: u16) -> f32
pub fn linear_scale(self, units_per_em: u16) -> f32
Sourcepub(crate) fn fixed_linear_scale(self, units_per_em: u16) -> Fixed
pub(crate) fn fixed_linear_scale(self, units_per_em: u16) -> Fixed
Computes a fixed point linear scale factor that matches FreeType.
Trait Implementations§
Source§impl From<Size> for DrawSettings<'_>
impl From<Size> for DrawSettings<'_>
Source§impl PartialOrd for Size
impl PartialOrd for Size
impl Copy for Size
impl StructuralPartialEq for Size
Auto Trait Implementations§
impl Freeze for Size
impl RefUnwindSafe for Size
impl Send for Size
impl Sync for Size
impl Unpin for Size
impl UnwindSafe for Size
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