use super::{
attribute::Attributes,
charmap::Charmap,
instance::{LocationRef, NormalizedCoord, Size},
metrics::{GlyphMetrics, Metrics},
string::{LocalizedStrings, StringId},
};
pub trait MetadataProvider<'a>: raw::TableProvider<'a> + Sized {
fn attributes(&self) -> Attributes {
Attributes::new(self)
}
fn localized_strings(&self, id: StringId) -> LocalizedStrings<'a> {
LocalizedStrings::new(self, id)
}
fn metrics(&self, size: Size, location: impl Into<LocationRef<'a>>) -> Metrics {
Metrics::new(self, size, location)
}
fn glyph_metrics(&self, size: Size, location: impl Into<LocationRef<'a>>) -> GlyphMetrics<'a> {
GlyphMetrics::new(self, size, location)
}
fn charmap(&self) -> Charmap<'a> {
Charmap::new(self)
}
}
impl<'a, T> MetadataProvider<'a> for T where T: raw::TableProvider<'a> {}