diff options
Diffstat (limited to 'src/library')
| -rw-r--r-- | src/library/deco.rs | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/library/deco.rs b/src/library/deco.rs index 3e91d1de..5f27c8be 100644 --- a/src/library/deco.rs +++ b/src/library/deco.rs @@ -38,6 +38,41 @@ pub struct Decoration { pub extent: Linear, } +impl Decoration { + /// Create a new underline with default settings. + pub const fn underline() -> Self { + Self { + line: DecoLine::Underline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } + + /// Create a new strikethrough with default settings. + pub const fn strikethrough() -> Self { + Self { + line: DecoLine::Underline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } + + /// Create a new overline with default settings. + pub const fn overline() -> Self { + Self { + line: DecoLine::Overline, + stroke: None, + thickness: None, + offset: None, + extent: Linear::zero(), + } + } +} + /// The kind of decorative line. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum DecoLine { @@ -49,7 +84,7 @@ pub enum DecoLine { Overline, } -/// Differents kinds of decorative lines for text. +/// Different kinds of decorative lines for text. pub trait LineKind { const LINE: DecoLine; } |
