diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-25 21:32:33 +0100 |
| commit | 76fc4cca62f5b955200b2c62cc85b69eea491ece (patch) | |
| tree | 5b8492268c996cf23b13e26c7a4356fbd156286d /src/layout/text.rs | |
| parent | e8057a53856dc09594c9e5861f1cd328531616e0 (diff) | |
Refactor alignments & directions 📐
- Adds lang function
- Refactors execution context
- Adds StackChild and ParChild enums
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs deleted file mode 100644 index 39866907..00000000 --- a/src/layout/text.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::fmt::{self, Debug, Formatter}; - -use super::*; -use crate::exec::FontProps; - -/// A consecutive, styled run of text. -#[derive(Clone, PartialEq)] -pub struct TextNode { - /// The text direction. - pub dir: Dir, - /// How to align this text node in its parent. - pub aligns: LayoutAligns, - /// The text. - pub text: String, - /// Properties used for font selection and layout. - pub props: FontProps, -} - -impl Layout for TextNode { - fn layout(&self, ctx: &mut LayoutContext, _: &Areas) -> Fragment { - let frame = shape(&self.text, &mut ctx.env.fonts, &self.props); - Fragment::Frame(frame, self.aligns) - } -} - -impl Debug for TextNode { - fn fmt(&self, f: &mut Formatter) -> fmt::Result { - write!(f, "Text({})", self.text) - } -} - -impl From<TextNode> for Node { - fn from(text: TextNode) -> Self { - Self::Text(text) - } -} |
