diff options
| author | Laurenz <laurmaedje@gmail.com> | 2020-08-02 21:17:42 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2020-08-02 21:17:42 +0200 |
| commit | cbbc46215fe0a0ad8a50e991ec442890b8eadc0a (patch) | |
| tree | 2efbac21cec46787f1efe0a859564b9614eefa98 /src/layout/mod.rs | |
| parent | d5ff97f42ed1e682a66ea8d51e5f9ed1be547b9c (diff) | |
Layout elements and pure rust rendering 🥏
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 64a2825b..41a314f0 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -2,17 +2,14 @@ use std::fmt::{self, Display, Formatter}; -#[cfg(feature = "serialize")] -use serde::Serialize; - -use fontdock::FaceId; use crate::geom::{Size, Margins}; -use self::prelude::*; +use elements::LayoutElements; +use prelude::*; pub mod line; pub mod stack; pub mod text; -pub_use_mod!(actions); +pub mod elements; pub_use_mod!(model); /// Basic types used across the layouting engine. @@ -33,30 +30,13 @@ pub type MultiLayout = Vec<Layout>; /// A finished box with content at fixed positions. #[derive(Debug, Clone, PartialEq)] -#[cfg_attr(feature = "serialize", derive(Serialize))] pub struct Layout { /// The size of the box. pub dimensions: Size, /// How to align this layout in a parent container. - #[cfg_attr(feature = "serialize", serde(skip))] pub align: LayoutAlign, /// The actions composing this layout. - pub actions: Vec<LayoutAction>, -} - -impl Layout { - /// Returns a vector with all used font indices. - pub fn find_used_fonts(&self) -> Vec<FaceId> { - let mut fonts = Vec::new(); - for action in &self.actions { - if let &LayoutAction::SetFont(id, _) = action { - if !fonts.contains(&id) { - fonts.push(id); - } - } - } - fonts - } + pub elements: LayoutElements, } /// A vector of layout spaces, that is stack allocated as long as it only |
