rustybuzz/hb/ot/layout/GPOS/
single_pos.rs1use 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 = ctx.buffer.cur(0).as_glyph();
9 let record = match self {
10 Self::Format1 { coverage, value } => {
11 coverage.get(glyph)?;
12 *value
13 }
14 Self::Format2 { coverage, values } => {
15 let index = 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}