1use crate::hb::ot_layout_gpos_table::ValueRecordExt;
2use crate::hb::ot_layout_gsubgpos::Apply;
3use crate::hb::ot_layout_gsubgpos::OT::hb_ot_apply_context_t;
4use ttf_parser::gpos::SingleAdjustment;
5
6impl Apply for SingleAdjustment<'_> {
7 fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> {
8 let glyph: GlyphId = ctx.buffer.cur(0).as_glyph();
9 let record: ValueRecord<'_> = match self {
10 Self::Format1 { coverage: &Coverage<'_>, value: &ValueRecord<'_> } => {
11 coverage.get(glyph)?;
12 *value
13 }
14 Self::Format2 { coverage: &Coverage<'_>, values: &ValueRecordsArray<'_> } => {
15 let index: u16 = coverage.get(glyph)?;
16 values.get(index)?
17 }
18 };
19 record.apply(ctx, ctx.buffer.idx);
20 ctx.buffer.idx += 1;
21 Some(())
22 }
23}
24