Skip to main content

TextConfig

Struct TextConfig 

Source
pub struct TextConfig {
Show 16 fields pub position_size_config: Option<PositionSizeConfig>, pub clip_rect: Option<Option<PositionSizeConfig>>, pub hidden: Option<bool>, pub ignore_render_layer: Option<bool>, pub content: Option<String>, pub font_size: Option<f32>, pub color: Option<[u8; 3]>, pub alpha: Option<u8>, pub background_color: Option<[u8; 3]>, pub background_alpha: Option<u8>, pub background_rounding: Option<f32>, pub font: Option<String>, pub selectable: Option<bool>, pub hyperlink_text: Option<Vec<(String, HyperlinkSelectMethod)>>, pub auto_fit: Option<[bool; 2]>, pub tags: Option<Vec<[String; 2]>>,
}
Expand description

Config options for text resources.

文本资源的配置选项。

Fields§

§position_size_config: Option<PositionSizeConfig>

Config for position, size, and layout.

位置、尺寸和布局配置。

§clip_rect: Option<Option<PositionSizeConfig>>

Optional clipping rectangle that defines the visible area.

定义可见区域的可选裁剪矩形。

§hidden: Option<bool>

Controls whether the text is visible or hidden.

控制文本是否可见或隐藏。

§ignore_render_layer: Option<bool>

If true, the text ignores render layer.

如果为true,文本忽略渲染层。

§content: Option<String>

Text content to be displayed.

要显示的文本内容。

§font_size: Option<f32>

Font size in points.

字体大小(点)。

§color: Option<[u8; 3]>

Text color as [R, G, B].

文本颜色,格式为[R, G, B]。

§alpha: Option<u8>

Opacity of the text (0-255).

文本的不透明度(0-255)。

§background_color: Option<[u8; 3]>

Background color behind the text as [R, G, B].

文本背后的背景颜色,格式为[R, G, B]。

§background_alpha: Option<u8>

Opacity of the background (0-255).

背景的不透明度(0-255)。

§background_rounding: Option<f32>

Radius for rounded corners of the background.

背景圆角半径。

§font: Option<String>

The font used for the specified text.

指定文本使用的字体。

§selectable: Option<bool>

Whether the text can be selected by the user.

文本是否可以被用户选择。

§hyperlink_text: Option<Vec<(String, HyperlinkSelectMethod)>>

Hyperlink texts for clickable regions.

可点击区域的超链接文本。

§auto_fit: Option<[bool; 2]>

Automatically adjust size to fit content.

自动调整尺寸以适应内容。

§tags: Option<Vec<[String; 2]>>

Key-value pairs for categorization and metadata.

用于分类和元数据的键值对标签。

Implementations§

Source§

impl TextConfig

Source

pub fn from_text(text: &Text) -> Self

Source

pub fn position_size_config( self, position_size_config: Option<PositionSizeConfig>, ) -> Self

Source

pub fn clip_rect(self, clip_rect: Option<Option<PositionSizeConfig>>) -> Self

Source

pub fn hidden(self, hidden: Option<bool>) -> Self

Source

pub fn ignore_render_layer(self, ignore_render_layer: Option<bool>) -> Self

Source

pub fn content(self, content: Option<String>) -> Self

Source

pub fn font_size(self, font_size: Option<f32>) -> Self

Source

pub fn color(self, color: Option<[u8; 3]>) -> Self

Source

pub fn alpha(self, alpha: Option<u8>) -> Self

Source

pub fn background_color(self, background_color: Option<[u8; 3]>) -> Self

Source

pub fn background_alpha(self, background_alpha: Option<u8>) -> Self

Source

pub fn background_rounding(self, background_rounding: Option<f32>) -> Self

Source

pub fn font(self, font: Option<String>) -> Self

Source

pub fn selectable(self, selectable: Option<bool>) -> Self

Source

pub fn auto_fit(self, auto_fit: Option<[bool; 2]>) -> Self

Source

pub fn tags(self, tags: Option<Vec<[String; 2]>>) -> Self

Trait Implementations§

Source§

impl Clone for TextConfig

Source§

fn clone(&self) -> TextConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TextConfig

Source§

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

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

impl Default for TextConfig

Source§

fn default() -> TextConfig

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

impl PartialEq for TextConfig

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 PartialOrd for TextConfig

Source§

fn partial_cmp(&self, other: &TextConfig) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for TextConfig

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, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,