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] MATH: don't serialize coverage table when iterator is empty #3319

Merged
merged 1 commit into from
Dec 3, 2021
Merged

[subset] MATH: don't serialize coverage table when iterator is empty #3319

merged 1 commit into from
Dec 3, 2021

Conversation

qxliu76
Copy link
Collaborator

@qxliu76 qxliu76 commented Dec 3, 2021

when iterator is empty, just set coverage offset to 0.
serialize() in coverage will at least write out a 16-bit format header.

I didn't change serialize() method to return early, since I noticed sometimes fonttools keeps this header for other tables.
This minor cosmetic change mainly aims to match fonttools's result for MATH table, so that we have less diff noise during ttx comparison.

when iterator is empty, just set coverage offset to 0.
serialize() in coverage will at lease write out a 16-bit format header.
@behdad
Copy link
Member

behdad commented Dec 3, 2021

I didn't change serialize() method to return early, since I noticed sometimes fonttools keeps this header for other tables.
This minor cosmetic change mainly aims to match fonttools's result for MATH table, so that we have less diff noise during ttx comparison.

Well, then find a software engineer to do the thinking for you to see if we can change fonttools as well to remove that header. Then come back.

@behdad
Copy link
Member

behdad commented Dec 3, 2021

I didn't change serialize() method to return early

The real reason probably has to do with this: serialize returning false means "failed". It's only subset returning false that means "not needed".

@behdad behdad reopened this Dec 3, 2021
@behdad behdad merged commit 74b46b2 into harfbuzz:main Dec 3, 2021
@behdad
Copy link
Member

behdad commented Dec 3, 2021

sometimes fonttools keeps this header for other tables

Can you point to examples? I have a hard time imagining that.

@qxliu76
Copy link
Collaborator Author

qxliu76 commented Dec 3, 2021

sometimes fonttools keeps this header for other tables

Can you point to examples? I have a hard time imagining that.

Here's an example:
pyftsubset test/subset/data/fonts/Roboto-Regular.abc.ttf --text=abc --output-file=test.ttf

In output GDEF table, there're non-zero coverage offsets for empty coverage tables in MarkGlyphSetsDef

I found some comments in harfbuzz code explaining this:
//not using o->serialize_subset (c, offset, this, out) here because
//OTS doesn't allow null offset.
//See issue: khaledhosny/ots#172

@behdad
Copy link
Member

behdad commented Dec 3, 2021

In output GDEF table, there're non-zero coverage offsets for empty coverage tables in MarkGlyphSetsDef

Okay, thanks. Next time please include all your findings such that the reviewer can make an informed decision. FontTools is not impeccable, so "to match fonttools" is not enough reason to write code in HarfBuzz. Thanks.

@qxliu76
Copy link
Collaborator Author

qxliu76 commented Dec 3, 2021

In output GDEF table, there're non-zero coverage offsets for empty coverage tables in MarkGlyphSetsDef

Okay, thanks. Next time please include all your findings such that the reviewer can make an informed decision. FontTools is not impeccable, so "to match fonttools" is not enough reason to write code in HarfBuzz. Thanks.

sure!

@qxliu76 qxliu76 deleted the coverage_fix branch December 3, 2021 18:06
@khaledhosny
Copy link
Collaborator

FWIW, both Chrome and Firefox release builds don't pass the three G* layout tables to OTS, so you might want to ignore it's illuminations regarding these tables.

@behdad
Copy link
Member

behdad commented Dec 3, 2021

FWIW, both Chrome and Firefox release builds don't pass the three G* layout tables to OTS, so you might want to ignore it's illuminations regarding these tables.

Yeah I was thinking it might be time we should relax that limitation in fonttools subsetter as well, as I think OTS was fixed a while back. Khaled, do you remember?

@khaledhosny
Copy link
Collaborator

I think we fixed some of these null offsets long ago, it is worth retesting if OTS still rejects them

@behdad
Copy link
Member

behdad commented Dec 3, 2021

I think we fixed some of these null offsets long ago, it is worth retesting if OTS still rejects them

Yeah that's also my recollection.

@behdad
Copy link
Member

behdad commented Dec 3, 2021

Yeah that's also my recollection.

@qxliu76 Is that something you can look into?

@qxliu76
Copy link
Collaborator Author

qxliu76 commented Dec 3, 2021

Yeah that's also my recollection.

@qxliu76 Is that something you can look into?
yeah, I can try to do some testing

@khaledhosny khaledhosny added the subset hb-subset related bugs label Dec 6, 2021
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.

4 participants