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

Cross script kerning #811

Merged
merged 8 commits into from
Jan 22, 2024
Merged

Cross script kerning #811

merged 8 commits into from
Jan 22, 2024

Conversation

khaledhosny
Copy link
Collaborator

Since several implementations can apply cross-script kerning, instead of splitting cross-script kerning pairs, we now keep all kerning for scripts which have common kerning pairs in one lookup and split the rest if any.

Fixes #808

@khaledhosny khaledhosny force-pushed the cross-script-kerning branch 6 times, most recently from df0267b to 779e0d1 Compare January 21, 2024 17:51
@khaledhosny khaledhosny marked this pull request as ready for review January 21, 2024 18:07
@khaledhosny
Copy link
Collaborator Author

I think this is ready for review.

Several implementations can apply kerning cross-script, so instead of
splitting cross-script kerning pairs, we now keep all kerning for
scripts which have common kerning pairs in one lookup and split the rest.
@anthrotype
Copy link
Member

we now keep all kerning for scripts which have common kerning pairs in one lookup

... as long as they have the same horizontal script direction, that is. Mixed script directions still aren't allowed in the same lookup, and that's ok.

Lib/ufo2ft/featureWriters/kernFeatureWriter.py Outdated Show resolved Hide resolved
} kern_Grek;

lookup kern_Latn {
@kern1.Cyrl_Grek_Latn_Orya.bar = [a-cy];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if these class names may get too long, I believe FEA imposes some limits on the length. Maybe it's fine and we do already take care of ensuring the names are compliant and unique?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, feaLib has a limit of 63 char limit on class names, but makeotf does not. fonttools/fonttools#3424 should fix this (and #588 as well).

We already make sure names are unique.

Copy link
Member

@anthrotype anthrotype left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with minor comments

khaledhosny added a commit to fonttools/fonttools that referenced this pull request Jan 22, 2024
These were implemented to follow FEA spec, but makeotf does not seem to
have a length limit on class names, and the glyph names limit (if it
still has it, I didn’t check) seems like an implementation detail we
don’t have to enforce.

Fixes googlefonts/ufo2ft#588
See also googlefonts/ufo2ft#811 (comment)
khaledhosny and others added 3 commits January 22, 2024 14:26
Co-authored-by: Cosimo Lupo <clupo@google.com>
Co-authored-by: Cosimo Lupo <clupo@google.com>
Co-authored-by: Cosimo Lupo <clupo@google.com>
khaledhosny added a commit to fonttools/fonttools that referenced this pull request Jan 22, 2024
These were implemented to follow FEA spec, but makeotf does not seem to
have a name length limit any more (or it has a very large one, I tested
a 600-character name and it was accepted).

Fixes googlefonts/ufo2ft#588
See also googlefonts/ufo2ft#811 (comment)
khaledhosny added a commit to fonttools/fonttools that referenced this pull request Jan 22, 2024
These were implemented to follow FEA spec, but makeotf does not seem to
have a name length limit any more (or it has a very large one, I tested
a 600-character name and it was accepted).

Fixes googlefonts/ufo2ft#588
See also googlefonts/ufo2ft#811 (comment)
@anthrotype
Copy link
Member

It would also be nice to add some logging that reports if/when kerning pairs between glyphs from different scripts get merged into the same kern lookup, because it might be unintentional and the font developer may be inadvertently getting a sparser (and potentially larger?) GPOS table simply because some glyphs are being used in multiple script contexts (either because doubly cmapped or because substituted to by GSUB rules that make their script-ness ambiguous).

@anthrotype
Copy link
Member

Thanks, lgtm. Feel free to merge when you're ready.
I'll cut the release tomorrow

@khaledhosny khaledhosny merged commit db583e3 into main Jan 22, 2024
9 checks passed
@khaledhosny khaledhosny deleted the cross-script-kerning branch January 22, 2024 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross-script kerning
2 participants