-
Notifications
You must be signed in to change notification settings - Fork 24
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
[read-fonts] Basic closure of glyphs over GSUB #775
Conversation
As I said in chat, it may matter if there are lookups that aren't referenced by any feature so they will never be applied, the subsetter treats these as if they aren't there for the sake of the closure. Even if this situation is arguably not very frequent, I think it makes sense to match that and also skip them in here. |
This differs from the fonttools implementation slightly, but I'm not sure if those differences are functional or just a result of how fonttools is organized.
I've cleaned this up a bit and added tests. I also now have a clearer sense of what fonttools is doing that we're not, and that is more carefully handling contextual lookups, so that we only apply lookups referenced by contextual lookups if we have all the glyphs to match that context. I think it's worth doing this, but I also think it makes sense to do it as a followup. |
I’m wondering if we can find a nice abstraction for the six contextual subtables that would simplify both closure and shaping. I’ll noodle on this a bit today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fea based tests are pretty slick! Closure logic LGTM with one question on the reverse chain stuff.
.chain(self.lookahead_coverages().iter()) | ||
{ | ||
if !coverage?.iter().any(|gid| glyphs.contains(&gid)) { | ||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should return?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, definitely. :)
I'd forgotten this behaved more like a normal lookup than a contextual lookup.
This differs from the fonttools implementation slightly, but I'm not sure if those differences are functional or just a result of how fonttools is organized.
This is a draft because I'd like to figure out tests, but I want to give cosimo a chance to look at it now and see if anything jumps out. In particular I've skipped the fancy logic at https://github.com/fonttools/fonttools/blob/534ceed9db1f5c0355d9ecd73b57db143d79a921/Lib/fontTools/subset/__init__.py#L1832-L1841 because afaict it shouldn't matter? but maybe there's some python magic going on that I'm not aware of..