googlefonts/fontations

make `traversal` feature non-public, delete otexplorer

Opened this issue · 3 comments

cmyr commented

This is a tracking issue for something agreed in chat.

No problem making this feature non-public, but what's the expected replacement? Serializing fonts is extremely useful, as evidenced by the widespread use of TTX.

cmyr commented

The only planned serialization support would be to write tables out in the binary format provided by the spec, using write-fonts. What sort of API would you need, for things like diffinator?

So for context: we have a Python tool called diffenator2 which is used both in the google/fonts onboarding QA process and in the QA process for various Secret Font Projects as well. But being Python it is struggling to cope with very large design spaces, and we don't want Python in the brave new world anyway, so I ported it to Rust, with source here and a WASM-based web version here.

One way in which both diffenator2 and diffenator3 find differences in fonts is by serializing and comparing the contents of the font at a field-based level. For example:

Screenshot 2024-08-20 at 17 04 06

It's a very good way of sorting out what's changed structurally between two font binaries. (Who knows, it may also be a useful tool for testing differences between font compilers. But I digress...)

If you look at https://github.com/googlefonts/diffenator3/blob/main/src/ttj/serializefont.rs you'll see how I've cobbled together a JSON serializer out of the traversal API. It's not pretty but it works; something better would be wonderful, but at the minimum, something similar which allows me to traverse the font and get field names and values would work for this use case. (Something serde-alike would be the ideal...)