diff options
| author | Laurenz Mädje <laurmaedje@gmail.com> | 2019-06-02 18:01:22 +0200 |
|---|---|---|
| committer | Laurenz Mädje <laurmaedje@gmail.com> | 2019-06-02 18:01:22 +0200 |
| commit | 221934df4b586250b0063282ef8885c475dec7a7 (patch) | |
| tree | ea91eb6fe6fbad71377f2dbf1c23a3a808dbf970 /src/layout/mod.rs | |
| parent | c4eb4ee36261be8832b2649cc075edee188be5c7 (diff) | |
Add margins with basic box layouter 📖
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index edcd63a7..ab27314d 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -6,9 +6,11 @@ use crate::syntax::{SyntaxTree, Node}; mod size; mod text; +mod boxed; -pub use size::Size; +pub use size::{Size, Position, Extent}; pub use text::TextLayouter; +pub use boxed::BoxLayouter; /// Layout a syntax tree in a given context. @@ -44,7 +46,7 @@ pub fn layout(tree: &SyntaxTree, ctx: &LayoutContext) -> LayoutResult<Layout> { #[derive(Debug, Clone)] pub struct Layout { /// The extent of this layout into all directions. - extent: LayoutDimensions, + extent: Extent, /// Actions composing this layout. actions: Vec<TextAction>, } @@ -75,20 +77,11 @@ pub struct LayoutContext<'a, 'p> { /// Loads fonts matching queries. pub loader: &'a FontLoader<'p>, /// The spacial constraints to layout in. - pub max_extent: LayoutDimensions, + pub max_extent: Extent, /// Base style to set text with. pub text_style: TextStyle, } -/// A space to layout in. -#[derive(Debug, Clone)] -pub struct LayoutDimensions { - /// Horizontal extent. - pub width: Size, - /// Vertical extent. - pub height: Size, -} - /// Default styles for text. #[derive(Debug, Clone)] pub struct TextStyle { |
