pub struct Dim { /* private fields */ }Expand description
TeX-style dimension: width, height, depth, italic correction, mu.
One unit is one em at the current math style unless a method says otherwise.
§Examples
use latex_rust::Dim;
let half = Dim::ratio(1, 2);
assert!(half.eq_dim(&(&Dim::one() / &Dim::from_i64(2))));
assert!(!Dim::zero().eq_dim(&Dim::one()));Implementations§
Source§impl Dim
impl Dim
Sourcepub fn from_font_units(units: i64, units_per_em: u16) -> Self
pub fn from_font_units(units: i64, units_per_em: u16) -> Self
Convert integer font units to em: units / units_per_em.
Sourcepub fn clamp_nonneg(&self) -> Self
pub fn clamp_nonneg(&self) -> Self
max(self, 0).
Sourcepub fn to_dec_string(&self) -> String
pub fn to_dec_string(&self) -> String
Decimal string (exact terminating expansion, or scientific).
Sourcepub fn to_svg_string(&self) -> String
pub fn to_svg_string(&self) -> String
Compact decimal for SVG attributes.
Sourcepub fn from_ieee32_bits(bits: u32) -> Self
pub fn from_ieee32_bits(bits: u32) -> Self
Layout dimension from an IEEE-754 binary32 bit pattern (outline boundary).
Sourcepub fn to_ieee32_bits(&self) -> u32
pub fn to_ieee32_bits(&self) -> u32
Round to IEEE-754 binary32 bits for PNG / raster emission only.
Sourcepub fn floor_to_u32(&self) -> Result<u32, Error>
pub fn floor_to_u32(&self) -> Result<u32, Error>
Largest u32 that is not greater than self. Negative and NaN fail.
Sourcepub fn ceil_to_u32(&self) -> Result<u32, Error>
pub fn ceil_to_u32(&self) -> Result<u32, Error>
Smallest u32 that is not less than self.
Trait Implementations§
impl Eq for Dim
Source§impl PartialOrd for Dim
impl PartialOrd for Dim
Auto Trait Implementations§
impl Freeze for Dim
impl RefUnwindSafe for Dim
impl Send for Dim
impl Sync for Dim
impl Unpin for Dim
impl UnsafeUnpin for Dim
impl UnwindSafe for Dim
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