From 264a7dedd42e27cd9e604037640cf0594b2ec46b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Fri, 19 Mar 2021 17:57:31 +0100 Subject: =?UTF-8?q?Scheduled=20maintenance=20=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- src/layout/text.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/layout/text.rs') 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 for Node { - fn from(text: NodeText) -> Self { +impl From for Node { + fn from(text: TextNode) -> Self { Self::Text(text) } } -- cgit v1.2.3