Skip to content

Commit

Permalink
[glyphs-reader/font] ignore duplicate global metrics, first wins
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Feb 14, 2025
1 parent 92b89b3 commit 7da4c32
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion glyphs-reader/src/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,13 @@ impl TryFrom<RawFont> for Font {
metric_names.get(&idx).map(|name| (name.clone(), value))
})
.filter(|(_, metric)| !metric.is_empty())
.collect(),
.fold(BTreeMap::new(), |mut acc, (name, value)| {
// only insert a metric if one with the same name hasn't been added
// yet; matches glyphsLib's behavior where the first duplicate wins
// https://github.com/googlefonts/fontc/issues/1269
acc.entry(name).or_insert(value);
acc
}),
number_values: from
.numbers
.iter()
Expand Down

0 comments on commit 7da4c32

Please sign in to comment.