| 1 | use crate::hb::ot_layout::LayoutLookup; |
| 2 | use crate::hb::ot_layout_common::PositioningLookup; |
| 3 | use crate::hb::ot_layout_gsubgpos::Apply; |
| 4 | use crate::hb::ot_layout_gsubgpos::OT::hb_ot_apply_context_t; |
| 5 | use crate::hb::set_digest::{hb_set_digest_ext, hb_set_digest_t}; |
| 6 | |
| 7 | impl LayoutLookup for PositioningLookup<'_> { |
| 8 | fn props(&self) -> u32 { |
| 9 | self.props |
| 10 | } |
| 11 | |
| 12 | fn is_reverse(&self) -> bool { |
| 13 | false |
| 14 | } |
| 15 | |
| 16 | fn digest(&self) -> &hb_set_digest_t { |
| 17 | &self.set_digest |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | impl Apply for PositioningLookup<'_> { |
| 22 | fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> { |
| 23 | if self.digest().may_have_glyph(ctx.buffer.cur(0).as_glyph()) { |
| 24 | for subtable: &PositioningSubtable<'_> in &self.subtables { |
| 25 | if subtable.apply(ctx).is_some() { |
| 26 | return Some(()); |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | None |
| 32 | } |
| 33 | } |
| 34 | |