summaryrefslogtreecommitdiff
path: root/src/font/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-19 01:16:35 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-19 01:16:35 +0100
commitb4b022940b908d8fe490b9f4f68bc60dcfb76cd2 (patch)
treebc93a2f51295f97f971466ab87bdd763c0ed6002 /src/font/mod.rs
parentba384e5bb6c2455eb431f6e1fcc8b98aca1e9879 (diff)
Syntax and example sections
Diffstat (limited to 'src/font/mod.rs')
-rw-r--r--src/font/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/font/mod.rs b/src/font/mod.rs
index 98875d8f..13189b6d 100644
--- a/src/font/mod.rs
+++ b/src/font/mod.rs
@@ -69,6 +69,12 @@ impl Font {
})))
}
+ /// Parse all fonts in the given data.
+ pub fn iter(data: Buffer) -> impl Iterator<Item = Self> {
+ let count = ttf_parser::fonts_in_collection(&data).unwrap_or(1);
+ (0..count).filter_map(move |index| Self::new(data.clone(), index))
+ }
+
/// The underlying buffer.
pub fn data(&self) -> &Buffer {
&self.0.data