Skip to main content

TextStyle

Struct TextStyle 

Source
pub struct TextStyle {
Show 13 fields pub weight: Option<u16>, pub italic: bool, pub underline: bool, pub strike: bool, pub color: Option<Color>, pub highlight: Option<Highlight>, pub size: f32, pub font: FontRole, pub link: bool, pub shadow: Option<Shadow>, pub ring: Option<RingMark>, pub dot: Option<DotMark>, pub aside: Option<AsideSide>,
}
Expand description

可叠加的文字样式。span 嵌套时逐字段合并。

Fields§

§weight: Option<u16>

字重(CSS 习惯值:细 300 / 常规 400 / 粗 700,内置字体 100–900 都有真实例)。 None = 跟随语境:正文常规,标题 / 表头加粗。

§italic: bool

斜体。

§underline: bool

下划线。

§strike: bool

删除线。

§color: Option<Color>

文字色;None = 用主题文字色。

§highlight: Option<Highlight>

高亮底色;None = 无高亮。

§size: f32

相对基准字号的倍率(默认 1.0)。

§font: FontRole

字族角色。

§link: bool

链接文字(标记文本 [文字](URL) 的产物):无显式 color 时按主题强调色渲染。 图片不可点,URL 本身不展示。

§shadow: Option<Shadow>

文字阴影;None = 无。

§ring: Option<RingMark>

圈注:以这段文字为中心画一圈椭圆描边(醒目标注,如圈出日历上的某天;不参与 布局尺寸,圈溢出到行距里)。

§dot: Option<DotMark>

着重点:这段文字正下方一枚实心小点(中文「着重号」式标注;画进行距,不占高度)。

§aside: Option<AsideSide>

边注:这段文字挂到本行内容的外侧(左或右),参与绘制、不参与布局——行宽与 居中 / 对齐都按其余内容算,边注不挤不偏(与圈注 / 着重点同一哲学)。适合 「当前」「✓」这类行尾行首标记。多行段落里右边注跟末行、左边注跟首行;整段 只有边注没有正文时按普通内容排(边注失去锚点)。

Trait Implementations§

Source§

impl Clone for TextStyle

Source§

fn clone(&self) -> TextStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TextStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TextStyle

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TextStyle

Source§

fn eq(&self, other: &TextStyle) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TextStyle

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.