Skip to content

Commit

Permalink
fontbe/gvar: don't skip glyphs without variations
Browse files Browse the repository at this point in the history
Fixes #388
  • Loading branch information
anthrotype committed Aug 10, 2023
1 parent ee8d100 commit 21d9ab7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions fontbe/src/gvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,7 @@ fn make_variations(
glyph_order
.iter()
.enumerate()
.filter_map(|(gid, gn)| {
let deltas = get_deltas(gn);
if deltas.is_empty() {
return None;
}
Some((GlyphId::new(gid as u16), deltas))
})
.map(|(gid, deltas)| GlyphVariations::new(gid, deltas))
.map(|(gid, gn)| GlyphVariations::new(GlyphId::new(gid as u16), get_deltas(gn)))
.collect()
}

Expand Down Expand Up @@ -99,7 +92,9 @@ mod tests {
use super::make_variations;

#[test]
fn skips_empty_variations() {
fn do_not_skip_empty_variations() {
// gvar contains a GlyphVariationData for each glyph in the 'glyf' table
// whether or not it contains any deltas for that glyph.
let glyph_with_var = "has_var";
let glyph_without_var = "no_var";
let mut glyph_order = GlyphOrder::new();
Expand All @@ -119,6 +114,6 @@ mod tests {
}
});

assert_eq!(1, variations.len(), "{variations:?}");
assert_eq!(2, variations.len(), "{variations:?}");
}
}

0 comments on commit 21d9ab7

Please sign in to comment.