use super::*;
use font_test_data::gsub as test_data;
#[test]
fn singlesubstformat1() {
let table = SingleSubstFormat1::read(test_data::SINGLESUBSTFORMAT1_TABLE.into()).unwrap();
assert_eq!(table.delta_glyph_id(), 192);
}
#[test]
fn singlesubstformat2() {
let table = SingleSubstFormat2::read(test_data::SINGLESUBSTFORMAT2_TABLE.into()).unwrap();
assert_eq!(
table.substitute_glyph_ids(),
&[
GlyphId16::new(305),
GlyphId16::new(309),
GlyphId16::new(318),
GlyphId16::new(323)
],
);
}
#[test]
fn multiplesubstformat1() {
let table = MultipleSubstFormat1::read(test_data::MULTIPLESUBSTFORMAT1_TABLE.into()).unwrap();
assert_eq!(table.sequences().len(), 1);
let seq0 = table.sequences().get(0).unwrap();
assert_eq!(
seq0.substitute_glyph_ids(),
&[GlyphId16::new(26), GlyphId16::new(26), GlyphId16::new(29)]
);
}
#[test]
fn alternatesubstformat1() {
let table = AlternateSubstFormat1::read(test_data::ALTERNATESUBSTFORMAT1_TABLE.into()).unwrap();
assert_eq!(table.alternate_sets().len(), 1);
let altset0 = table.alternate_sets().get(0).unwrap();
assert_eq!(
altset0.alternate_glyph_ids(),
&[GlyphId16::new(0xc9), GlyphId16::new(0xca)]
);
}
#[test]
fn ligaturesubstformat1() {
let table = LigatureSubstFormat1::read(test_data::LIGATURESUBSTFORMAT1_TABLE.into()).unwrap();
assert_eq!(table.ligature_sets().len(), 2);
let ligset0 = table.ligature_sets().get(0).unwrap();
assert_eq!(ligset0.ligatures().len(), 1);
let lig0 = ligset0.ligatures().get(0).unwrap();
assert_eq!(lig0.ligature_glyph(), GlyphId16::new(347));
assert_eq!(
lig0.component_glyph_ids(),
&[GlyphId16::new(0x28), GlyphId16::new(0x17)]
);
let ligset1 = table.ligature_sets().get(1).unwrap();
let lig0 = ligset1.ligatures().get(0).unwrap();
assert_eq!(lig0.ligature_glyph(), GlyphId16::new(0xf1));
assert_eq!(
lig0.component_glyph_ids(),
&[GlyphId16::new(0x1a), GlyphId16::new(0x1d)]
);
}