pub struct ResolvedTextStyle {
pub size: f32,
pub weight: FontWeight,
pub italic: bool,
pub color: Option<Color>,
pub decoration: TextDecoration,
pub decoration_color: Option<Color>,
pub height: Option<f32>,
pub family: Option<FontFamily>,
pub letter_spacing: f32,
}Expand description
Type as the renderer receives it, and the framework’s defaults.
A TextStyle with every question answered: what to measure with, and what to draw.
The colour stays optional, and deliberately. Size, weight and slant have a framework
default that is right everywhere; a colour’s last word belongs to the theme, which this
type cannot see. A widget resolves it at paint against on_surface.
Fields§
§size: f32Font size, in logical pixels.
weight: FontWeightWeight.
italic: boolItalic.
color: Option<Color>Explicit colour; None means the widget resolves it against the theme.
decoration: TextDecorationDecoration lines.
decoration_color: Option<Color>Decoration colour; None means the text’s own colour.
height: Option<f32>The line’s height as a multiple of the font size; None means
DEFAULT_LINE_HEIGHT. Read it through line_height.
family: Option<FontFamily>The font family; None means the application’s default. See
TextStyle::family for why it does not always win.
letter_spacing: f32The room added after every character, in logical pixels; 0 for none.
Implementations§
Source§impl ResolvedTextStyle
impl ResolvedTextStyle
Sourcepub fn line_height(&self) -> f32
pub fn line_height(&self) -> f32
The height of one line, in logical pixels.
The one place this number is decided. It used to be a LINE_HEIGHT_FACTOR
constant in frus-text and another in frus-gpu, which is two constants that
had to agree: a measure and a paint disagreeing about how tall a line is puts the
second line of every paragraph somewhere the layout did not reserve.
Sourcepub const fn exact(size: f32) -> ResolvedTextStyle
pub const fn exact(size: f32) -> ResolvedTextStyle
A style of exactly this size — regular, upright, undecorated, and not put through the reader’s font setting.
For glyphs whose size is geometry rather than type: an icon on its 24 px grid, a
marker that has to stay inside a circle drawn beside it. The reference’s Icon is
sized by IconTheme and ignores the text scaler for the same reason — an icon that
grew with the type would leave its own box.
Everything a reader reads wants
TextStyle::new(size).resolved() instead. The two are one
keyword apart on purpose: the choice is worth stating at every call, which is why
there is no third form that guesses.
Trait Implementations§
Source§impl Clone for ResolvedTextStyle
impl Clone for ResolvedTextStyle
Source§fn clone(&self) -> ResolvedTextStyle
fn clone(&self) -> ResolvedTextStyle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more