pub struct ResolvedFontSpec {
pub family: Arc<str>,
pub size: f32,
pub defined_size: Option<FontSize>,
pub weight: u16,
pub style: FontStyle,
pub color: Rgba,
}Expand description
A resolved (non-optional) font specification produced after theme resolution.
Unlike FontSpec, every field but defined_size
is required (non-optional) because resolution has already filled in all
defaults.
No Default derive: ResolvedFontSpec is always
constructed from a fully populated unresolved source; any “zero”
instance is a placeholder sentinel built manually (see
resolve::validate_helpers::resolved_font_spec_sentinel).
Fields§
§family: Arc<str>Font family name.
size: f32Font size in logical pixels. A size stated in points is converted at
the resolution context’s
font_dpi.
defined_size: Option<FontSize>The size as its source stated it, before conversion.
size is always logical pixels, which is what a toolkit
lays out with. This is the unit and number the preset or the platform
reader actually gave: the OS readers and the platform presets other
than Material state points, and Material and the community
colour-scheme presets state pixels.
Anything that shows a size to a person should show this. The two
cannot be told apart after conversion – a 14px preset and a 10.5pt
one at 96 DPI both resolve to 14.0 – so a display that divides
size by the DPI would label the first as points, which no source
ever said.
None only where the source stated no size at all and validation
recorded the omission.
weight: u16CSS font weight (100–900).
style: FontStyleFont style (normal, italic, oblique).
color: RgbaFont color.