summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs15
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> {