googlefonts / fontc

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

maxp values for composite points and contours are significantly off for some sources #1022

Closed rsheeter closed 1 month ago

rsheeter commented 1 month ago

soft-type-jersey/sources/Jersey25.glyphs:


$ python resources/scripts/ttx_diff.py --compare default ~/oss/font_repos/soft-type-jersey/sources/Jersey25.glyphs
...
  DIFF 'maxp', /usr/local/google/home/rsheeter/oss/fontc/build/default/fontc.maxp.ttx /usr/local/google/home/rsheeter/oss/fontc/build/default/fontmake.maxp.ttx (90.0%)

$ diff /usr/local/google/home/rsheeter/oss/fontc/build/default/fontc.maxp.ttx /usr/local/google/home/rsheeter/oss/fontc/build/default/fontmake.maxp.ttx
7,8c7,8
<     <maxCompositePoints value="16"/>
<     <maxCompositeContours value="4"/>
---
>     <maxCompositePoints value="2092"/>
>     <maxCompositeContours value="523"/>
...

Not even close to the same!

https://github.com/fonttools/fonttools/blob/e8146a6d0725d398cfa110cba683946ee762f8e2/Lib/fontTools/ttLib/tables/_m_a_x_p.py#L53 appears to show FontTools computation.
rsheeter commented 1 month ago

Evidently Rust and python only agree on num points and contours for 22 of 362 glyphs. Seems like a poor score lol.

Edit: we have an errant HashSet which leads to repeat use of the same component not counting properly