pub fn into_map(self) -> Result<Map> {
        let mut kerning_pairs: BTreeMap<char, BTreeMap<char, Length>> = BTreeMap::new();
        for ((lclass, rclass), length) in &self.pairs {
            let lefts = self.class(Direction::Left, lclass)?;
            let rights = self.class(Direction::Right, rclass)?;
            for l in lefts.chars() {
                if let Some(lmap) = kerning_pairs.get_mut(&l) {
                    lmap.extend(rights.chars().map(|r| (r, *length)));
                } else {
                    kerning_pairs.insert(l, rights.chars().map(|r| (r, *length)).collect());
                }
            }
        }

        Ok(kerning_pairs)
    }
/// Compiles this specification into a full kerning pairs map.
///
/// # Errors
///
/// Fails if a kerning pair in the spec refers to a missing table.
Compiles this specification into a full kerning pairs map.
Compiles this specification into a full kerning pairs map .
pub fn into_map(self) -> Result<Map> {
        let mut kerning_pairs: BTreeMap<char, BTreeMap<char, Length>> = BTreeMap::new();
        for ((lclass, rclass), length) in &self.pairs {
            let lefts = self.class(Direction::Left, lclass)?;
            let rights = self.class(Direction::Right, rclass)?;
            for l in lefts.chars() {
                if let Some(lmap) = kerning_pairs.get_mut(&l) {
                    lmap.extend(rights.chars().map(|r| (r, *length)));
                } else {
                    kerning_pairs.insert(l, rights.chars().map(|r| (r, *length)).collect());
                }
            }
        }
        Ok(kerning_pairs)
    }
pub fn into_map ( self ) -> Result < Map > { let mut kerning_pairs : BTreeMap < char , BTreeMap < char , Length > > = BTreeMap :: new ( ) ; for ( ( lclass , rclass ) , length ) in & self . pairs { let lefts = self . class ( Direction :: Left , lclass ) ? ; let rights = self . class ( Direction :: Right , rclass ) ? ; for l in lefts . chars ( ) { if let Some ( lmap ) = kerning_pairs . get_mut ( & l ) { lmap . extend ( rights . chars ( ) . map ( | r | ( r , * length ) ) ) ; } else { kerning_pairs . insert ( l , rights . chars ( ) . map ( | r | ( r , * length ) ) . collect ( ) ) ; } } } Ok ( kerning_pairs ) }
Compiles this specification into a full kerning pairs map.
Compiles this specification into a full kerning pairs map .
self
errors
Fails if a kerning pair in the spec refers to a missing table.
Fails if a kerning pair in the spec refers to a missing table .