pub struct TextFormat {
pub font_id: FontId,
pub extra_letter_spacing: f32,
pub line_height: Option<f32>,
pub color: Color32,
pub background: Color32,
pub expand_bg: f32,
pub coords: VariationCoords,
pub italics: bool,
pub underline: Stroke,
pub strikethrough: Stroke,
pub valign: Align,
}Expand description
Formatting option for a section of text.
Fields§
§font_id: FontId§extra_letter_spacing: f32Extra spacing between letters, in points.
Default: 0.0.
line_height: Option<f32>Explicit line height of the text in points.
This is the distance between the bottom row of two subsequent lines of text.
If None (the default), the line height is determined by the font.
If the line height differs from the height of the font,
the text is vertically centered within the line height (like in CSS),
regardless of Self::valign.
For even text it is recommended you round this to an even number of pixels.
color: Color32Text color
background: Color32§expand_bg: f32Amount to expand background fill by.
Default: 1.0
coords: VariationCoords§italics: bool§underline: Stroke§strikethrough: Stroke§valign: AlignIf you use a small font and Align::TOP you
can get the effect of raised text.
If you use a small font and Align::BOTTOM
you get the effect of a subscript.
If you use Align::Center, you get text that is centered
around a common center-line, which is nice when mixining emojis
and normal text in e.g. a button.
The alignment is applied to the difference between the height of the row
and the Self::line_height of this section.
Any extra space from an explicit Self::line_height is always split evenly
above and below the text.
Default: Align::BOTTOM.
Implementations§
Source§impl TextFormat
impl TextFormat
pub fn simple(font_id: FontId, color: Color32) -> TextFormat
Trait Implementations§
Source§impl Clone for TextFormat
impl Clone for TextFormat
Source§fn clone(&self) -> TextFormat
fn clone(&self) -> TextFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextFormat
impl Debug for TextFormat
Source§impl Default for TextFormat
impl Default for TextFormat
Source§fn default() -> TextFormat
fn default() -> TextFormat
Source§impl Hash for TextFormat
impl Hash for TextFormat
Source§impl PartialEq for TextFormat
impl PartialEq for TextFormat
impl StructuralPartialEq for TextFormat
Auto Trait Implementations§
impl Forget for TextFormat
impl Freeze for TextFormat
impl Move for TextFormat
impl RefUnwindSafe for TextFormat
impl Send for TextFormat
impl Sync for TextFormat
impl Unpin for TextFormat
impl UnsafeUnpin for TextFormat
impl UnwindSafe for TextFormat
Blanket Implementations§
impl<T> AsId for T
impl<T> AsIdSalt for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more