googlefonts / fontc

Where in we pursue oxidizing (context: https://github.com/googlefonts/oxidize) fontmake.
Apache License 2.0
85 stars 14 forks source link

head.checkSumAdjustment not set, always 0x0 #945

Open anthrotype opened 2 months ago

anthrotype commented 2 months ago

fontc is not computing the head table's checkSumAdjustment field, so it defaults to 0x0. And neither is write_fonts. Not sure whose responsibility it should be, whether the client (fontc) or write_fonts itself. Probably the latter?

Anyway, ttx_diff.py currently erases the field altogether so we may get "fonts are identical" but actually the checkSumAdjustment is plain wrong.

Ok, you may argue it's garbage anyway and nobody should trust that, but if we want to be nice we should just compute that correctly, e.g. the same way fontmake/fonttools would, with all the "BiboAfba" and funny things like that:

https://github.com/fonttools/fonttools/blob/c2119229cfb02cdb7c5a63374ef29d3d514259e8/Lib/fontTools/ttLib/sfnt.py#L375-L406

rsheeter commented 2 months ago

https://github.com/googlefonts/fontations/blob/6d01f7425b52f06d23d8e24f433f09d2e3779ac5/write-fonts/src/font_builder.rs#L102 is computing table directory checksums and strikes me as the appropriate place to do it, update head if there is a head.

anthrotype commented 2 months ago

sgtm. we could transfer the issue over to the fontations repo maybe

rsheeter commented 2 months ago

Maybe open a new one there and reference it? - it's still true that fontc has a bug so I think we shoudl keep this one even if the fix ends up just being an update to our fontations version.