diff options
author | 2024-09-04 21:25:59 +0200 | |
---|---|---|
committer | 2024-09-04 21:26:47 +0200 | |
commit | f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7 (patch) | |
tree | 8fb3e8b470bff711e0ca2f1bf120ab6c66ba9a9d /core/src/text.rs | |
parent | 8d826cc662554b337282e7c982383f5db428d7aa (diff) | |
download | iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.tar.gz iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.tar.bz2 iced-f98328f4f1ee58b6288e4f19d7475e7eeb9a7ba7.zip |
Add `text::Wrapping` support
Co-authored-by: Neeraj Jaiswal <neerajj85@gmail.com>
Diffstat (limited to 'core/src/text.rs')
-rw-r--r-- | core/src/text.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/text.rs b/core/src/text.rs index dc8f5785..d7b7fee4 100644 --- a/core/src/text.rs +++ b/core/src/text.rs @@ -41,6 +41,9 @@ pub struct Text<Content = String, Font = crate::Font> { /// The [`Shaping`] strategy of the [`Text`]. pub shaping: Shaping, + + /// The [`Wrapping`] strategy of the [`Text`]. + pub wrapping: Wrapping, } /// The shaping strategy of some text. @@ -67,6 +70,22 @@ pub enum Shaping { Advanced, } +/// The wrapping strategy of some text. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)] +pub enum Wrapping { + /// No wrapping. + None, + /// Wraps at the word level. + /// + /// This is the default. + #[default] + Word, + /// Wraps at the glyph level. + Glyph, + /// Wraps at the word level, or fallback to glyph level if a word can't fit on a line by itself. + WordOrGlyph, +} + /// The height of a line of text in a paragraph. #[derive(Debug, Clone, Copy, PartialEq)] pub enum LineHeight { |