include!("../../generated/generated_gsub.rs");
use super::layout::{
ChainedSequenceContext, CoverageTable, FeatureList, FeatureVariations, Lookup, LookupList,
LookupType, ScriptList, SequenceContext,
};
#[cfg(test)]
#[path = "../tests/test_gsub.rs"]
mod tests;
type SubstitutionLookupList = LookupList<SubstitutionLookup>;
super::layout::table_newtype!(
SubstitutionSequenceContext,
SequenceContext,
read_fonts::tables::layout::SequenceContext<'a>
);
super::layout::table_newtype!(
SubstitutionChainContext,
ChainedSequenceContext,
read_fonts::tables::layout::ChainedSequenceContext<'a>
);
impl Gsub {
fn compute_version(&self) -> MajorMinor {
if self.feature_variations.is_none() {
MajorMinor::VERSION_1_0
} else {
MajorMinor::VERSION_1_1
}
}
}
super::layout::lookup_type!(SingleSubst, 1);
super::layout::lookup_type!(MultipleSubstFormat1, 2);
super::layout::lookup_type!(AlternateSubstFormat1, 3);
super::layout::lookup_type!(LigatureSubstFormat1, 4);
super::layout::lookup_type!(SubstitutionSequenceContext, 5);
super::layout::lookup_type!(SubstitutionChainContext, 6);
super::layout::lookup_type!(ExtensionSubtable, 7);
super::layout::lookup_type!(ReverseChainSingleSubstFormat1, 8);
impl<T: LookupType + FontWrite> FontWrite for ExtensionSubstFormat1<T> {
fn write_into(&self, writer: &mut TableWriter) {
1u16.write_into(writer);
T::TYPE.write_into(writer);
self.extension.write_into(writer);
}
}
impl<'a> FontRead<'a> for SubstitutionLookup {
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
read_fonts::tables::gsub::SubstitutionLookup::read(data).map(|x| x.to_owned_table())
}
}
impl<'a> FontRead<'a> for SubstitutionLookupList {
fn read(data: FontData<'a>) -> Result<Self, ReadError> {
read_fonts::tables::gsub::SubstitutionLookupList::read(data).map(|x| x.to_owned_table())
}
}