Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MissingAxisTentError when building Oswald #427

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 30 additions & 18 deletions fontbe/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ impl<'a> VariationInfo for FeaVariationInfo<'a> {
// https://learn.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#variation-regions
// Array of region axis coordinates records, in the order of axes given in the 'fvar' table.
let mut region_axes = Vec::with_capacity(self.static_metadata.variable_axes.len());
for axis in self.static_metadata.axes.iter() {
for axis in self.static_metadata.variable_axes.iter() {
let Some(tent) = region.get(&axis.tag) else {
return Err(Box::new(MissingTentError::new(axis.tag)));
};
Expand Down Expand Up @@ -618,23 +618,35 @@ mod tests {
StaticMetadata::new(
1024,
Default::default(),
vec![Axis {
name: "Weight".to_string(),
tag: Tag::new(b"wght"),
min: min_wght_user,
default: def_wght_user,
max: max_wght_user,
hidden: false,
converter: CoordConverter::new(
vec![
// the design values don't really matter
(min_wght_user, DesignCoord::new(0.0)),
(def_wght_user, DesignCoord::new(1.0)),
(max_wght_user, DesignCoord::new(2.0)),
],
1,
),
}],
vec![
Axis {
name: "Weight".to_string(),
tag: Tag::new(b"wght"),
min: min_wght_user,
default: def_wght_user,
max: max_wght_user,
hidden: false,
converter: CoordConverter::new(
vec![
// the design values don't really matter
(min_wght_user, DesignCoord::new(0.0)),
(def_wght_user, DesignCoord::new(1.0)),
(max_wght_user, DesignCoord::new(2.0)),
],
1,
),
},
// no-op 'point' axis, should be ignored
Axis {
name: "Width".to_string(),
tag: Tag::new(b"wdth"),
min: UserCoord::new(0.0),
default: UserCoord::new(0.0),
max: UserCoord::new(0.0),
hidden: false,
converter: CoordConverter::new(vec![], 0),
},
],
Default::default(),
HashSet::from([min_wght, def_wght, max_wght]),
)
Expand Down