1 | use crate::hb::ot_layout_gsubgpos::OT::hb_ot_apply_context_t; |
2 | use crate::hb::ot_layout_gsubgpos::{Apply, WouldApply, WouldApplyContext}; |
3 | use ttf_parser::gsub::LigatureSet; |
4 | |
5 | impl WouldApply for LigatureSet<'_> { |
6 | fn would_apply(&self, ctx: &WouldApplyContext) -> bool { |
7 | self.into_iter().any(|lig: Ligature<'_>| lig.would_apply(ctx)) |
8 | } |
9 | } |
10 | |
11 | impl Apply for LigatureSet<'_> { |
12 | fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> { |
13 | for lig: Ligature<'_> in self.into_iter() { |
14 | if lig.apply(ctx).is_some() { |
15 | return Some(()); |
16 | } |
17 | } |
18 | None |
19 | |
20 | // TODO: port https://github.com/harfbuzz/harfbuzz/commit/7881eadff and |
21 | // the following commits. Since it's behind a feature flag, we ignore it |
22 | // for now and just use the simpler version. |
23 | } |
24 | } |
25 | |