diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-03-19 17:57:31 +0100 |
| commit | 264a7dedd42e27cd9e604037640cf0594b2ec46b (patch) | |
| tree | d26feea399d54bb86bd44878f40293983bf5251d /src/layout/text.rs | |
| parent | ca3df70e2a5069832d7d2135967674c34a155442 (diff) | |
Scheduled maintenance 🔨
- New naming scheme
- TextNode instead of NodeText
- CallExpr instead of ExprCall
- ...
- Less glob imports
- Removes Value::Args variant
- Removes prelude
- Renames Layouted to Fragment
- Moves font into env
- Moves shaping into layout
- Moves frame into separate module
Diffstat (limited to 'src/layout/text.rs')
| -rw-r--r-- | src/layout/text.rs | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/layout/text.rs b/src/layout/text.rs index 7b4eb08e..7faefa0d 100644 --- a/src/layout/text.rs +++ b/src/layout/text.rs @@ -4,11 +4,10 @@ use std::rc::Rc; use fontdock::{FallbackTree, FontVariant}; use super::*; -use crate::shaping::{shape, VerticalFontMetric}; -/// A text node. +/// A consecutive, styled run of text. #[derive(Clone, PartialEq)] -pub struct NodeText { +pub struct TextNode { /// The text. pub text: String, /// The text direction. @@ -27,9 +26,9 @@ pub struct NodeText { pub bottom_edge: VerticalFontMetric, } -impl Layout for NodeText { - fn layout(&self, ctx: &mut LayoutContext, _: &Areas) -> Layouted { - Layouted::Frame( +impl Layout for TextNode { + fn layout(&self, ctx: &mut LayoutContext, _: &Areas) -> Fragment { + Fragment::Frame( shape( &self.text, self.dir, @@ -45,14 +44,14 @@ impl Layout for NodeText { } } -impl Debug for NodeText { +impl Debug for TextNode { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "Text({})", self.text) } } -impl From<NodeText> for Node { - fn from(text: NodeText) -> Self { +impl From<TextNode> for Node { + fn from(text: TextNode) -> Self { Self::Text(text) } } |
