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.
定义可见区域的可选裁剪矩形。
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.
自动调整尺寸以适应内容。
Key-value pairs for categorization and metadata.
用于分类和元数据的键值对标签。
Implementations§
Source§impl TextConfig
impl TextConfig
pub fn from_text(text: &Text) -> Self
pub fn position_size_config( self, position_size_config: Option<PositionSizeConfig>, ) -> Self
pub fn clip_rect(self, clip_rect: Option<Option<PositionSizeConfig>>) -> Self
pub fn ignore_render_layer(self, ignore_render_layer: Option<bool>) -> Self
pub fn content(self, content: Option<String>) -> Self
pub fn font_size(self, font_size: Option<f32>) -> Self
pub fn color(self, color: Option<[u8; 3]>) -> Self
pub fn alpha(self, alpha: Option<u8>) -> Self
pub fn background_color(self, background_color: Option<[u8; 3]>) -> Self
pub fn background_alpha(self, background_alpha: Option<u8>) -> Self
pub fn background_rounding(self, background_rounding: Option<f32>) -> Self
pub fn font(self, font: Option<String>) -> Self
pub fn selectable(self, selectable: Option<bool>) -> Self
pub fn hyperlink_text( self, hyperlink_text: Option<Vec<(String, HyperlinkSelectMethod)>>, ) -> Self
pub fn auto_fit(self, auto_fit: Option<[bool; 2]>) -> Self
Trait Implementations§
Source§impl Clone for TextConfig
impl Clone for TextConfig
Source§fn clone(&self) -> TextConfig
fn clone(&self) -> TextConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TextConfig
impl Debug for TextConfig
Source§impl Default for TextConfig
impl Default for TextConfig
Source§fn default() -> TextConfig
fn default() -> TextConfig
Source§impl PartialEq for TextConfig
impl PartialEq for TextConfig
Source§impl PartialOrd for TextConfig
impl PartialOrd for TextConfig
impl StructuralPartialEq for TextConfig
Auto Trait Implementations§
impl Freeze for TextConfig
impl RefUnwindSafe for TextConfig
impl Send for TextConfig
impl Sync for TextConfig
impl Unpin for TextConfig
impl UnsafeUnpin for TextConfig
impl UnwindSafe for TextConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().