What is the best way to add a binary table to exported font

I want to build MATH table (from data stored in the .glyphs file) and add it to the binary font being exported, what is the beast way to do this (other then post-processing the binary font externally)?

There are currently no predefined custom parameters/layer naming scheme/etc. to store all of what could be put into the MATH table. You can define your own parameters/naming schemes and generate the table from that. I think fontTools can assemble the table, or custom binary table generation scripts. I have some related plugins in the works, but for now I use sfntedit to insert the MATH table into the exported font file.

Thanks, I can generate the MATH table fine (I have not totally figured out how to store the data in .glyphs file, but I don’t think it will be an issue). What I’m trying to avoid is using external tools to do this, if possible I want to be able to run a script inside glyphs to generate the table and add it to the binary file each time I export a font.

You can set up a simple plugin that registers a callback when a font is exported. Then you can access the data in the glyphs file and the final openType.

That sounds pretty much like what I want, are there any example of these or somewhere I can read about it? (I haven’t created any plugins before, so sorry if this should be obvious).

I cobbled together a plugin that runs a command after a file is exported: GitHub - florianpircher/Post-Export-Command: Work in progress.

Define a custom parameter with the name Post-Export Command on your instance or on the font. The value of the custom parameter is the name of a command. For example:

The command is run from the directory of the .glyphs file, so that you can place a shell script, a Python file, or any other program next to your Glyphs file. On export, the command is run with the full path of the exported font file as it first argument, like so:

./add-MATH-table.sh /Users/SomeUser/Fonts/SomeFont.ttf

Or, you can build your own plugin. See the GitHub repository for how the plugin is structured:

Just ask if any part is unclear. Note that I build this Post-Export Command plugin very quickly, so there can still be rough issues.

3 Likes

Thanks!