diff options
| author | 2024-09-04 21:42:11 +0200 | |
|---|---|---|
| committer | 2024-09-04 21:42:11 +0200 | |
| commit | 6009420b57933ccf799f1b7eac8debab950cdd5e (patch) | |
| tree | e6218826131a702e51adf3041a45871140bae0be /core/src/text.rs | |
| parent | 8d826cc662554b337282e7c982383f5db428d7aa (diff) | |
| parent | 3a70462a7232cc2b3a7cc3fe8d07f0c29cc578cc (diff) | |
| download | iced-6009420b57933ccf799f1b7eac8debab950cdd5e.tar.gz iced-6009420b57933ccf799f1b7eac8debab950cdd5e.tar.bz2 iced-6009420b57933ccf799f1b7eac8debab950cdd5e.zip | |
Merge pull request #2279 from nrjais/wrapping
Add `text::Wrapping` support
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 { |
