diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-04-17 13:25:31 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-04-17 13:26:49 +0200 |
| commit | 9bdc4a7de0fb685fa2b8d02280e70aa0b5d92bf9 (patch) | |
| tree | e67c75c32183e734272943107ad2d034b1e8e818 /library/src/text | |
| parent | 428c55b6eed3536bb228924c6fb0ad6cea6d6d4b (diff) | |
Write PDF outline
Diffstat (limited to 'library/src/text')
| -rw-r--r-- | library/src/text/misc.rs | 8 | ||||
| -rw-r--r-- | library/src/text/mod.rs | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index e1d9c0f2..a707d130 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -5,7 +5,7 @@ use crate::prelude::*; /// /// Display: Space /// Category: text -#[element(Unlabellable, Behave)] +#[element(Behave, Unlabellable, PlainText)] pub struct SpaceElem {} impl Behave for SpaceElem { @@ -16,6 +16,12 @@ impl Behave for SpaceElem { impl Unlabellable for SpaceElem {} +impl PlainText for SpaceElem { + fn plain_text(&self, text: &mut EcoString) { + text.push(' '); + } +} + /// Inserts a line break. /// /// Advances the paragraph to the next line. A single trailing line break at the diff --git a/library/src/text/mod.rs b/library/src/text/mod.rs index 16268aad..f4b3c0de 100644 --- a/library/src/text/mod.rs +++ b/library/src/text/mod.rs @@ -40,7 +40,7 @@ use crate::prelude::*; /// /// Display: Text /// Category: text -#[element(Construct)] +#[element(Construct, PlainText)] pub struct TextElem { /// A prioritized sequence of font families. /// @@ -497,6 +497,12 @@ impl Construct for TextElem { } } +impl PlainText for TextElem { + fn plain_text(&self, text: &mut EcoString) { + text.push_str(&self.text()); + } +} + /// A lowercased font family like "arial". #[derive(Clone, Eq, PartialEq, Hash)] pub struct FontFamily(EcoString); |
