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

[subset] Add more variable font subsetting tests #2912

Merged
merged 4 commits into from
Apr 1, 2021

Conversation

garretrieger
Copy link
Collaborator

Fix a couple issues that popped up:

  • Don't keep FeatureVariationRecord's which have no substitutions.
  • Don't drop Features if they are referenced in a retained FeatureVariation substitution even if they are otherwise empty.

@garretrieger garretrieger changed the title Add more variable font subsetting tests [subset] Add more variable font subsetting tests Mar 26, 2021
@behdad
Copy link
Member

behdad commented Mar 29, 2021

  • Don't keep FeatureVariationRecord's which have no substitutions.

That's definitely not what your code does. "conditions" vs "substitutions".

Which can be dropped is non-trivial. See: #2334 (comment)

Since we are not instancing, the Conditions don't really change...

@garretrieger
Copy link
Collaborator Author

Good catch, I'll rework this.

@khaledhosny khaledhosny added the subset hb-subset related bugs label Mar 30, 2021
@behdad behdad marked this pull request as draft April 1, 2021 17:39
@garretrieger garretrieger force-pushed the vf_tests branch 2 times, most recently from 37f5f55 to eaa3240 Compare April 1, 2021 20:38
@garretrieger garretrieger marked this pull request as ready for review April 1, 2021 20:39
@@ -1117,8 +1117,9 @@ struct Feature
;

out->lookupIndex.serialize (c->serializer, l, it);
return_trace (bool (it) || subset_featureParams
|| (tag && *tag == HB_TAG ('p', 'r', 'e', 'f')));
Copy link
Member

Choose a reason for hiding this comment

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

What happens to this pref case? There was a reason we added that. Breaks shaping with certain scripts (Khmer?) I think. Probably fonttools doesn't have it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll look into it. If we want this then we'll need to check for it during feature collection since if we drop a feature here that the feature collection was planning to keep the remapped feature indices get out of sync with the actual list of subsetted features.

Copy link
Member

Choose a reason for hiding this comment

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

If we want this then we'll need to check for it during feature collection

Right.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh misread that, this always keeps "pref" which fontTools does too: https://github.com/fonttools/fonttools/blob/main/Lib/fontTools/subset/__init__.py#L1280. I'll check the feature collection code to make sure it's doing the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll fix this in a separate PR, this change won't make the current behaviour any worse since this method now always returns true.

Only drop records with no matching features that are at the end of the list. See: fonttools/fonttools@cab7d13
@behdad
Copy link
Member

behdad commented Apr 1, 2021

Sure. I trust that you would. :) LGTM.

@garretrieger garretrieger merged commit 55e7f3f into harfbuzz:master Apr 1, 2021
@garretrieger garretrieger deleted the vf_tests branch April 5, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subset hb-subset related bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants