summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-09 19:45:40 +0200
committerLaurenz <laurmaedje@gmail.com>2019-10-09 19:46:42 +0200
commitf22a3070001e9c8db6fcc7b83b036111a6559a3d (patch)
treea14c437a2ef71b08af5847c4f38330f668f724c2 /src/layout/mod.rs
parentb96a7e0cf3c97463ecb746d859b675541a427774 (diff)
Extract into separate repository 🧱
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 676024e8..6b040089 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -3,8 +3,10 @@
use std::borrow::Cow;
use std::mem;
+use toddle::query::{SharedFontLoader, FontClass};
+use toddle::Error as FontError;
+
use crate::doc::LayoutAction;
-use crate::font::{FontLoader, FontClass, FontError};
use crate::size::{Size, Size2D, SizeBox};
use crate::syntax::{SyntaxTree, Node, FuncCall};
use crate::style::TextStyle;
@@ -33,10 +35,10 @@ pub fn layout(tree: &SyntaxTree, ctx: LayoutContext) -> LayoutResult<BoxLayout>
}
/// The context for layouting.
-#[derive(Debug, Copy, Clone)]
+#[derive(Copy, Clone)]
pub struct LayoutContext<'a, 'p> {
/// Loads fonts matching queries.
- pub loader: &'a FontLoader<'p>,
+ pub loader: &'a SharedFontLoader<'p>,
/// Base style to set text with.
pub style: &'a TextStyle,
/// The space to layout in.
@@ -66,12 +68,11 @@ impl LayoutSpace {
}
/// Transforms a syntax tree into a box layout.
-#[derive(Debug)]
struct Layouter<'a, 'p> {
tree: &'a SyntaxTree,
box_layouter: BoxLayouter,
flex_layout: FlexLayout,
- loader: &'a FontLoader<'p>,
+ loader: &'a SharedFontLoader<'p>,
style: Cow<'a, TextStyle>,
}