use crate::handle::Handle;
#[derive(Debug)]
pub struct FamilyHandle {
pub(crate) fonts: Vec<Handle>,
}
impl Default for FamilyHandle {
fn default() -> Self {
Self::new()
}
}
impl FamilyHandle {
#[inline]
pub fn new() -> FamilyHandle {
FamilyHandle { fonts: vec![] }
}
#[inline]
pub fn from_font_handles<I>(fonts: I) -> FamilyHandle
where
I: Iterator<Item = Handle>,
{
FamilyHandle {
fonts: fonts.collect::<Vec<Handle>>(),
}
}
#[inline]
pub fn push(&mut self, font: Handle) {
self.fonts.push(font)
}
#[inline]
pub fn is_empty(&self) -> bool {
self.fonts.is_empty()
}
#[inline]
pub fn fonts(&self) -> &[Handle] {
&self.fonts
}
}