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

fix the order of prune_unused_regions #3268

Merged
merged 1 commit into from Sep 5, 2023
Merged

Conversation

qxliu76
Copy link
Contributor

@qxliu76 qxliu76 commented Aug 31, 2023

It should be after each vardata optimization.
Here's a testcase, I used this command fonttools varLib.instancer --no-overlap-flag --no-recalc-timestamp --no-optimize --output=ft.ttf test/subset/data/fonts/NotoSans-VF.abc.ttf wght=200:600 wdth=80:90 CTGR=20:60
File used is this: https://github.com/harfbuzz/harfbuzz/blob/main/test/subset/data/fonts/NotoSans-VF.abc.ttf
And generated MVAR table is like below:

<VarStore Format="1">
  <Format value="1"/>
  <VarRegionList>
    <!-- RegionAxisCount=3 -->
    <!-- RegionCount=4 -->
    <Region index="0">
  <!-- VarDataCount=1 -->
  <VarData index="0">
    <!-- ItemCount=2 -->
    <NumShorts value="0"/>
    <!-- VarRegionCount=2 -->
    <VarRegionIndex index="0" value="0"/>
    <VarRegionIndex index="1" value="3"/>
    <Item index="0" value="[-7, 6]"/>
    <Item index="1" value="[-4, 4]"/>
  </VarData>
</VarStore>

2 regions indexed at 1 and 2 are not used and not pruned.
This PR will fix it.

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.

thanks, makes sense, not sure why it was done that way to begin with. We need to also update the test expectations. I can take care of it if you want

@qxliu76
Copy link
Contributor Author

qxliu76 commented Sep 5, 2023

thanks, makes sense, not sure why it was done that way to begin with. We need to also update the test expectations. I can take care of it if you want

I have updated tests accordingly. Thanks!

@anthrotype anthrotype merged commit 02784f3 into fonttools:main Sep 5, 2023
10 checks passed
@anthrotype
Copy link
Member

Thanks 👍

@qxliu76 qxliu76 deleted the bug_fix branch September 5, 2023 18:31
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.

None yet

2 participants