Add text::Wrapping support
Co-authored-by: Neeraj Jaiswal <neerajj85@gmail.com>
This commit is contained in:
parent
8d826cc662
commit
f98328f4f1
21 changed files with 160 additions and 30 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue