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

Roundtripping NotoColorEmoji-Regular.ttf makes COLR table grow #3236

Closed
behdad opened this issue Aug 3, 2023 · 2 comments · Fixed by #3241
Closed

Roundtripping NotoColorEmoji-Regular.ttf makes COLR table grow #3236

behdad opened this issue Aug 3, 2023 · 2 comments · Fixed by #3241
Assignees

Comments

@behdad
Copy link
Member

behdad commented Aug 3, 2023

COLR table of original font is 1058175 bytes. Just roundtripping it through TTX makes it grow by 20kb to 1079817.

I have no explanation for this. COLRv1 uses all 24 or larger offsets types, so all object-sharing should happen all the same. This is very unsettling to me currently. :-)

Font file downloaded from https://fonts.google.com/noto/specimen/Noto+Color+Emoji (Click on "Download family").

@behdad
Copy link
Member Author

behdad commented Aug 3, 2023

Cosimo and I tracked this down to hb-subset vs fonttools packer difference. The smaller font is packed by hb-subset. The TTX of the two is the same, and there's no overflows. So this suggests a bug in the fonttools packer.

@behdad behdad self-assigned this Aug 3, 2023
@behdad
Copy link
Member Author

behdad commented Aug 3, 2023

I checked how many objects each packer is producing, and hb-subset's was about 3000 fewer.

I think I see what's going on. In FontTools packer, each OTTableWriter has a member offsetSize, which is the width of the offset to this table. So FontTools won't share an object that is reached to by different offset-sizes. The COLR table uses a mix of 32bit and 24bit offsets. I believe that's what's going on here.

behdad added a commit that referenced this issue Aug 3, 2023
behdad added a commit that referenced this issue Aug 3, 2023
behdad added a commit that referenced this issue Aug 3, 2023
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 a pull request may close this issue.

1 participant