pub struct Hundredths(/* private fields */);Expand description
A number a presentation value carries, in hundredths — 14 points is 1400,
a ratio of 1.3 is 130.
Fixed point rather than an f32 because a Style is stamped on every
glyph and compared for run-merging, so the type has to be Eq, and because
two spellings of the same number must be the same value: an author’s
14.0pt and the menu’s 14pt are one size, not two runs. Hundredths is
more precision than any menu writes and enough for the 13.25pt a fitted
theme lands on.
u16, so the largest value is 655.35 — past any type size a sheet of paper
holds and any line height a document means. A number above it is not a
number this vocabulary carries, and reads as None.
Implementations§
Source§impl Hundredths
impl Hundredths
Sourcepub fn from_f32(value: f32) -> Option<Self>
pub fn from_f32(value: f32) -> Option<Self>
The number value names, rounded to the nearest hundredth. None for
anything that is not a positive finite number this can hold — the same
answer the parsers give a value outside the grammar.
Sourcepub const fn hundredths(self) -> u16
pub const fn hundredths(self) -> u16
The hundredths themselves, for a frontend that would rather do integer arithmetic than divide and multiply back.
Trait Implementations§
Source§impl Clone for Hundredths
impl Clone for Hundredths
Source§fn clone(&self) -> Hundredths
fn clone(&self) -> Hundredths
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more