rustybuzz/hb/ot/layout/GSUB/
ligature_set.rs

1use crate::hb::ot_layout_gsubgpos::OT::hb_ot_apply_context_t;
2use crate::hb::ot_layout_gsubgpos::{Apply, WouldApply, WouldApplyContext};
3use ttf_parser::gsub::LigatureSet;
4
5impl WouldApply for LigatureSet<'_> {
6    fn would_apply(&self, ctx: &WouldApplyContext) -> bool {
7        self.into_iter().any(|lig| lig.would_apply(ctx))
8    }
9}
10
11impl Apply for LigatureSet<'_> {
12    fn apply(&self, ctx: &mut hb_ot_apply_context_t) -> Option<()> {
13        for lig in self.into_iter() {
14            if lig.apply(ctx).is_some() {
15                return Some(());
16            }
17        }
18        None
19    }
20}