Compile MinMax BASE table statements in fea#1763
Conversation
| match self.iter().next().map(|t| t.kind()) { | ||
| Some(Kind::HorizAxisMinMaxKw) => true, | ||
| Some(Kind::VertAxisMinMaxKw) => false, | ||
| other => panic!("unexpected token in BaseTagList {other:?}"), |
There was a problem hiding this comment.
copy/pasta? the panic message mentions BaseTagList but we're in BaseMinMax
| &mut self, | ||
| taglist: &typed::BaseTagList, | ||
| script_list: Option<typed::BaseScriptList>, | ||
| _minmax: impl Iterator<Item = typed::BaseMinMax>, |
There was a problem hiding this comment.
this is currently unused. potentially this method could check e.g. a script listed in MinMax exists in the script list, that the min/max values fit the signed i16 range, or duplicate entries etc.
There was a problem hiding this comment.
thought about this a bit... we don't have access to the root script list here, so we can't check that (at least here) and the other bits of validation feel unnecessary, and likely cause us to deviate from fontmake in any case.
The stuff that it's important to validate here is stuff that we will later want to assume is true. (For instance, we will later want to find the index of a given baseline tag for items in the script list, so we need to ensure that those tags exist).
| rest.push(BaseLangSysRecord::new(*tag, table.compile())); | ||
| } | ||
| } | ||
|
|
||
| (dflt, rest) |
There was a problem hiding this comment.
BaseLangSysRecords should be sorted "in alphabetical order by BaseLangSysTag"
https://learn.microsoft.com/en-us/typography/opentype/spec/base
I think we aren't sorting them here (and write-fonts isn't either?) so if fonts have multiple language specific minmax entries for the same scripts we'd keep them in insertion order rather than alphabetical
Or at least, the subset of this syntax that is also supported by feaLib.
- Better reuse of the logic that is identical for each axis - invariants around ordering are now managed by the builder at construction time, instead of needing to be handled by the caller
704ba5b to
98a67b1
Compare
closes #1676