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

Update KernFeatureWriter to write separate lookups without IgnoreMarks #314

Merged
merged 1 commit into from
Feb 22, 2019

Conversation

punchcutter
Copy link

To match Glyphs output for auto-generated lookups we need to determine if any kern pairs contain marks and then we don't want to use the IgnoreMarks flag on those lookups.

Also, some scripts get a dist feature by default, but it's entirely possible to have both kern and dist in the same font. There are no 100% clear rules about this, but if there is a contextual kern lookup in Glyphs then it will be added as kern.

Copy link
Contributor

@marekjez86 marekjez86 left a comment

Choose a reason for hiding this comment

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

LGTM

@marekjez86 marekjez86 merged commit c655892 into googlefonts:master Feb 22, 2019
@anthrotype
Copy link
Member

I would have liked to have the chance to review this...

@anthrotype
Copy link
Member

It’s OK, I can do any fixups if needed before the next release. Thanks Zachary!

@marekjez86
Copy link
Contributor

marekjez86 commented Feb 22, 2019 via email

@punchcutter
Copy link
Author

@anthrotype Yes, please let me know what you think. I don't necessarily like everything about this, but it is an issue that needs to be addressed. This came up when we added the IgnoreMarks flag in the first place, but now I really ran into it while prepping Noto Siddham for delivery.

@davelab6
Copy link
Member

davelab6 commented Feb 25, 2019 via email

@anthrotype
Copy link
Member

we need to determine if any kern pairs contain marks and then we don't want to use the IgnoreMarks flag on those lookups.

That makes sense. Can you remind me which Noto font requires this patch?

I'm not quite sure about the dist vs kern distinction that you make (still trying to figure out what the code does and why)

@anthrotype
Copy link
Member

@punchcutter ^

@punchcutter
Copy link
Author

One Noto font that needs this is Siddham.

The whole dist vs kern thing is kind of ridiculous in the first place because we are assuming that these things are optional or not. I have a hard time seeing when and where either would or should be optional, but some implementations don't apply kern by default and some apply dist by default so we have a mix of how these are implemented everywhere. ufo2ft adds a dist feature instead of kern for scripts that harfbuzz expects to have dist. Mostly Indic scripts that are expected to use dist and have dist turned on by default. However, there are no real rules that say it must be one way or another. It's perfectly valid to have a kern feature as well as dist. Both are using the same lookup types and doing the same exact thing.

So one thing I was thinking about here is how in Glyphs you can add custom contextual kerning. If the user explicitly defines a kern feature there then I believe we should respect that and write that as a kern feature even if the script is otherwise expected to get a dist feature. If the user explicitly defines the contextual kerning in a dist feature then we write it as dist. I don't really like how this works either way because automatic feature generation can't always be expected to figure out what the user wants.

@anthrotype
Copy link
Member

anthrotype commented Mar 19, 2019

I don't get why you had to modify the _groupScriptsByTagAndDirection method.

Previously this method would simply parse the languagesystem statements and group the script/languages pairs by 1) whether they need "dist" or can use "kern" and 2) the script's dominant horizontal direction. These groupings were mutually exclusive (e.g. a script can either be dist-enabled or not, but not both).

With your patch, the method now also checks wether feature kern string is present in the features text (should rather use findFeatureTags function in ufo2ft.featureWriters.ast module), and if so it groups the dist-enabled languagesystems under both "kern" and "dist".

I don't understand why you need to do that.

@anthrotype
Copy link
Member

what's wrong with outputting automatic dist feature even when user has some hand-coded kern feature?

@punchcutter
Copy link
Author

It should output automatic dist even when user has hand-coded kern. Either way I would expect both features if there is code for both features. Or code for one and automatic code for another.

@anthrotype
Copy link
Member

yeah, that's what I mean, the feature writer will add some automatically generated dist feature to the font, and whatever was there before (either 'kern' or none) stays untouched. That's the meaning of the mode "append".

@punchcutter
Copy link
Author

Isn't that what's happening now? I don't remember exactly what's going on, but you can do whatever is right. Sorry if it's a mess. I was expecting to have this conversation before it got merged, but that didn't work out.

@anthrotype
Copy link
Member

no problem, thanks!

I'll run this through Noto Siddham and make sure it does the right thing.

anthrotype added a commit to anthrotype/ufo2ft that referenced this pull request May 2, 2019
Basically cleaning up googlefonts#314

Also, updated expected test results;
reverted unnecessary changes to _groupScriptsByTagAndDirection;
removed unused addLookupReference function in ast module.

fixup
anthrotype added a commit to anthrotype/ufo2ft that referenced this pull request May 2, 2019
Basically cleaning up googlefonts#314

Also, updated expected test results;
reverted unnecessary changes to _groupScriptsByTagAndDirection;
removed unused addLookupReference function in ast module.
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.

4 participants