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
Use JSON UFOs for intermediate output #731
Comments
Thanks! This can all be done just with |
Yep. Instead of |
if you're calling fontmake as a subprocess (as you should) you just need to pass |
also, you want to depend on fontmake[json] extra which activates ufoLib2[json] extra which in turns pulls in cattrs and orjson |
After much trial and error I discovered that I need to write a function like this: def open_ufo(path):
if os.path.isdir(path):
return ufoLib2.Font.open(path)
else:
return ufoLib2.Font.json_loads(open(path, "rb").read()) |
yes, like fontmake itself does: https://github.com/googlefonts/fontmake/blob/6a8b2907891537ce559dd3d6fcfe68d8b55d6bc9/Lib/fontmake/font_project.py#L160-L169 we didn't want Font.open to handle json because this is not an official UFO format but only a private ufoLib2-only serialization format |
@simoncozens your |
I sort of see that for UFO libraries in general, this is ufoLib2 and we're talking about ufoLib2-specific format. It should be able to open its own files. |
Using standard UFOs in the new builder, on Noto Sans Mono (158 build steps, 120 targets) 1238.11s user 90.81s system 654% cpu 3:23.10 total Using JSON UFOs: 998.50s user 31.00s system 665% cpu 2:34.74 total 20% speed-up. Nice. |
Closing this because builder2 (which is the future) does it. |
* WIP new builder * These modules are now an integral part of the builder * Add subset adder (needs merge of #730) * Various noto fixes * Actually use tempdir for temporaries * Change case of recipe_provider to match others * Fix instance directory * Fix paths in noto builder * Include the googlefonts/ targets for noto * Fix building STAT tables * Add some validation for TTF builds * Comments * Compatibility with older Pythons * Build UI VFs * Use temporary directory for stamp files * Move main function * Fix command-line args * Build web fonts * Correct ninja syntax on Windows * Continue losing on Windows * Allow passing a dict config * Allow ints as well as hexints in subset YAML (for machine-generated configs) * Use JSON format UFOs for intermediaries, fixes #731 * Properly save JSON-based subset UFOs * Fix fontmake arguments * Everyone gets a STAT table! * Add --include-source-fixes when fixing googlefonts outputs * Call ninja and report exit status * Don't pass argv to ninja * Don’t do STAT inplace * Allow other args to subspacer * cmap remapper * I believe this makes buildSTAT work everywhere * Deepcopy steps so the YAML doesn't go all referency with --generate * Allow disabling buildWebfont! * Allow source->operation->source * Keep notdef outline, saves a FAIL * Add a --deep option to remap inside GSUB * Pass --deep option to remap * [builder2] Pass --glyph-data to fontmake when converting glyphs to ufo (#743) This seems to have been dropped during the refactoring. * Support glyphspackage * Quieten fontmake jobs * Use a jobrunner to quieten successful jobs and highlight failing ones * Add a build-vtt utility and operation * Port more options from the old builder * glyphData is an array * glyphData is an array, and only for Glyphs sources * Handier error message format * Let's not autohint OTFs * Don't run buildSTAT on woff2 as well * Documentation * Additional docs about recipe overrides * This seems to be needed? * Better handle recipe provider inheritance * Black * Use strictYAML, first step in getting proper validation * Consistently use "args", not "fontmake_args", "fixargs" etc. * Use schema to validate * Fix up notobuilder after strictYAMLification * This is yucky. * black * Autohint OTF * Move base schema to .schema, rename GF schema * Allow postprocess-only overrides * StrictYAML has made things confusing, use typing to help * Reformat with black * More strictyaml fixes * Make --generate work again with strictyaml * Everything that comes from .config is strictYAML now and needs .data * Revalidate STAT to schema * Make STAT values optional * More StrictYAML pollution * More StrictYAML pollution * More StrictYAML pollution, needed for UIVFs * Cope with the same step being in a recipe twice * Fail early on silly graphs * gf recipe: fix revalidate stat tables * gf recipe: fix flag typo * gf recipe: toggle compatibility check for ds sources as well * add missing import * autohintOTF: use --no-sonzes-stems if dflt fails * fix string concat * fix typo * Allow extra fontmake args in config file * Fix more StrictYAML annoyance * Add remap layout operation * Allow the use of $in and $out in exec args * Allow passing args to rename * Default autohintOTF to false * Derive output directory defaults from outputDir, fixes #846 --------- Co-authored-by: خالد حسني (Khaled Hosny) <khaled@aliftype.com> Co-authored-by: Marc Foley <m.foley.88@gmail.com>
Glyphs files are converted to normal UFOs currently, which is slow. Writing out JSON blobs is faster, especially for bigger projects.
The text was updated successfully, but these errors were encountered: