Skip to content
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

Disable JSON structure when using fontc #1067

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

simoncozens
Copy link
Contributor

Normally, gftools-builder uses a small optimisation - saving intermediate UFOs in ufoLib2's "JSON structure" which is faster to serialize and parse. However, we want to turn off this optimisation when running with fontc as it does not support this (undocumented, non-standard) UFO representation.

@simoncozens simoncozens requested a review from cmyr November 20, 2024 10:08
@simoncozens
Copy link
Contributor Author

@cmyr With this I can build Noto fonts using fontc, except of course all the static generation is gone.

@simoncozens simoncozens force-pushed the fontc-builder-no-json branch from 8f99e62 to 9429896 Compare November 20, 2024 10:56
@simoncozens
Copy link
Contributor Author

With --experimental-fontc, building Noto Sans Arabic now takes 1m 52s on my machine, compared to 1m 24 without, presumably because of the slower UFO marshalling.

I would be very interested in changing the fontc directory to a rust directory and using it to host Rust implementations of other operations, such as using triangulate to instantiate the UFOs, fontspector --hotfix instead of gftools-fix etc.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you're finding this helpful! My only real desire with the fontc-supporting code is that it continues to support the needs of crater as well as it does now, which means really doing the minimal amount of work possible to get us the artifacts we're comparing, which are one generated binary per run. So long as we can continue doing that as needed, then this looks good.

Do ping me before publishing please just so I can do a quick crater run locally and make sure everything is working as expected, none of this fontc stuff is really tested in CI...

@@ -69,13 +69,10 @@ def modify_config(self, config: dict):
extra_args = config.get("extraFontmakeArgs") or ""
extra_args += " --no-production-names --drop-implied-oncurves"
config["extraFontmakeArgs"] = extra_args
# override config to turn not build instances if we're variable
if self.will_build_variable_font(config):
config["buildStatic"] = False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you accomplishing this another way, or are you building statics? The current fontc mode is very much limited in focus to supporting the crater project, which lets us run both compilers and compare outputs, and I would like to avoid doing extra work in that case because it already takes quite a long time to run.

Maybe we could keep this, but have it be gated on the --fontc-experimental-single-source argument?

Lib/gftools/builder/__init__.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants