Skip to content

Commit

Permalink
Fix bug where glyphs were saved twice
Browse files Browse the repository at this point in the history
As pointed out in #157.
  • Loading branch information
cmyr committed Aug 12, 2021
1 parent fce1673 commit bcb1ddf
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,19 +349,14 @@ impl Layer {

self.layerinfo_to_file_if_needed(path, opts)?;

for (name, glyph_path) in self.contents.iter() {
let glyph = self.glyphs.get(name).expect("all glyphs in contents must exist.");
glyph.save_with_options(&path.join(glyph_path), opts)?;
}

#[cfg(feature = "rayon")]
let iter = self.contents.par_iter();
#[cfg(not(feature = "rayon"))]
let mut iter = self.contents.iter();

iter.try_for_each(|(name, glyph_path)| {
let glyph = self.glyphs.get(name).expect("all glyphs in contents must exist.");
glyph.save(path.join(glyph_path))
glyph.save_with_options(&path.join(glyph_path), opts)
})
}

Expand Down

0 comments on commit bcb1ddf

Please sign in to comment.