#[derive(Debug, Clone, Default)]
pub struct Fonts {
pub fonts: Vec<String>,
}
impl Fonts {
#[must_use]
pub fn new() -> Self {
Self::default()
}
pub fn add_font(&mut self, font: impl Into<String>) {
self.fonts.push(font.into());
}
#[must_use]
pub fn len(&self) -> usize {
self.fonts.len()
}
#[must_use]
pub fn is_empty(&self) -> bool {
self.fonts.is_empty()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn fonts_new() {
let f = Fonts::new();
assert!(f.is_empty());
}
#[test]
fn fonts_add() {
let mut f = Fonts::new();
f.add_font("<ofd:Font ID=\"1\"/>");
assert_eq!(f.len(), 1);
}
}