use super::read::{FontRead, Format, ReadError};
use crate::{
font_data::FontData,
offset::{Offset, ResolveOffset},
};
#[derive(Clone)]
pub struct TableRef<'a, T> {
pub(crate) shape: T,
pub(crate) data: FontData<'a>,
}
impl<'a, T> TableRef<'a, T> {
pub fn resolve_offset<O: Offset, R: FontRead<'a>>(&self, offset: O) -> Result<R, ReadError> {
offset.resolve(self.data)
}
pub fn offset_data(&self) -> FontData<'a> {
self.data
}
}
impl<U, T: Format<U>> Format<U> for TableRef<'_, T> {
const FORMAT: U = T::FORMAT;
}