diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-12-08 11:15:04 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-12-08 11:36:18 +0100 |
| commit | 64f938b449b7ff5e53b6a06ed943bf9dedc1014b (patch) | |
| tree | c8237458ea10c21e9b3ce9fc2c02bdd7df9a1fca /src | |
| parent | f364395e1d774456500ea61bb7b931f48a62ddfa (diff) | |
Improve testers ♻
Diffstat (limited to 'src')
| -rw-r--r-- | src/layout/mod.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index afdab1ef..7f9b9b95 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -45,6 +45,21 @@ pub struct Layout { pub actions: Vec<LayoutAction>, } +impl Layout { + /// Returns a vector with all used font indices. + pub fn find_used_fonts(&self) -> Vec<usize> { + let mut fonts = Vec::new(); + for action in &self.actions { + if let LayoutAction::SetFont(index, _) = action { + if !fonts.contains(index) { + fonts.push(*index); + } + } + } + fonts + } +} + /// The general context for layouting. #[derive(Debug, Clone)] pub struct LayoutContext<'a, 'p> { |
