diff options
author | 2024-07-28 17:22:32 +0200 | |
---|---|---|
committer | 2024-07-28 17:22:32 +0200 | |
commit | ebc6c0eba86608dbd9912ab180f48ca603f20c19 (patch) | |
tree | 8a3482278ee2ad2257c024f5b579925d279e3bf4 /core | |
parent | c47a6ed7b639cf76086554fe2b65a8acecb61ea2 (diff) | |
parent | 9ce55eb51113b79d57b981ccd971242528a36395 (diff) | |
download | iced-ebc6c0eba86608dbd9912ab180f48ca603f20c19.tar.gz iced-ebc6c0eba86608dbd9912ab180f48ca603f20c19.tar.bz2 iced-ebc6c0eba86608dbd9912ab180f48ca603f20c19.zip |
Merge pull request #2526 from iced-rs/feature/rich-text-underline
Underline support for `rich_text`
Diffstat (limited to 'core')
-rw-r--r-- | core/src/text.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/text.rs b/core/src/text.rs index 2f085bd8..68c586f1 100644 --- a/core/src/text.rs +++ b/core/src/text.rs @@ -245,6 +245,8 @@ pub struct Span<'a, Link = (), Font = crate::Font> { /// /// Currently, it only affects the bounds of the [`Highlight`]. pub padding: Padding, + /// Whether the [`Span`] should be underlined or not. + pub underline: bool, } /// A text highlight. @@ -268,6 +270,7 @@ impl<'a, Link, Font> Span<'a, Link, Font> { highlight: None, link: None, padding: Padding::ZERO, + underline: false, } } @@ -386,6 +389,12 @@ impl<'a, Link, Font> Span<'a, Link, Font> { self } + /// Sets whether the [`Span`] shoud be underlined or not. + pub fn underline(mut self, underline: bool) -> Self { + self.underline = underline; + self + } + /// Turns the [`Span`] into a static one. pub fn to_static(self) -> Span<'static, Link, Font> { Span { @@ -397,6 +406,7 @@ impl<'a, Link, Font> Span<'a, Link, Font> { link: self.link, highlight: self.highlight, padding: self.padding, + underline: self.underline, } } } |