pub struct RichTextSpec<'a> {
pub spans: &'a [TextSpan<'a>],
pub default_color: Color,
pub default_font_size: u8,
pub line_height_pct: u16,
pub align: TextAlign,
pub rtl_paragraph: bool,
pub max_lines: u8,
pub nowrap: bool,
}Expand description
富文本段落完整规格(分配于 ScratchArena,通过 8B 引用挂入 DrawPayload::RichText)。
Fields§
§spans: &'a [TextSpan<'a>]§default_color: Color§default_font_size: u8§line_height_pct: u16行高百分比(如 135 表示 1.35× 基准字号,默认 130)。
align: TextAlign§rtl_paragraph: bool是否以 RTL(右至左)为段落基准方向(自动启用 Unicode BiDi 视觉重排)。
max_lines: u8最大显示行数(0 表示不限制)。
nowrap: bool是否禁止自动折行。
Implementations§
Source§impl<'a> RichTextSpec<'a>
impl<'a> RichTextSpec<'a>
Trait Implementations§
Source§impl<'a> Clone for RichTextSpec<'a>
impl<'a> Clone for RichTextSpec<'a>
impl<'a> Copy for RichTextSpec<'a>
Source§impl<'a> Debug for RichTextSpec<'a>
impl<'a> Debug for RichTextSpec<'a>
impl<'a> Eq for RichTextSpec<'a>
Source§impl<'a> PartialEq for RichTextSpec<'a>
impl<'a> PartialEq for RichTextSpec<'a>
impl<'a> StructuralPartialEq for RichTextSpec<'a>
Auto Trait Implementations§
impl<'a> Forget for RichTextSpec<'a>
impl<'a> Freeze for RichTextSpec<'a>
impl<'a> Move for RichTextSpec<'a>
impl<'a> RefUnwindSafe for RichTextSpec<'a>
impl<'a> Send for RichTextSpec<'a>
impl<'a> Sync for RichTextSpec<'a>
impl<'a> Unpin for RichTextSpec<'a>
impl<'a> UnsafeUnpin for RichTextSpec<'a>
impl<'a> UnwindSafe for RichTextSpec<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。