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

Generate variable webfonts #535

Merged
merged 5 commits into from
Jan 18, 2023
Merged

Generate variable webfonts #535

merged 5 commits into from
Jan 18, 2023

Conversation

naiyerasif
Copy link
Contributor

This change adds fontTools.ttLib based build script that can generate variable webfonts from ttf files. It runs after the gftools and dumps the woff2 fonts in fonts/variable directory. The script does not modify any files generated by gftools.

A test run for this change (not including upload) is available here: https://github.com/naiyerasif/JetBrainsMono/runs/5702196890?check_suite_focus=true

@saschaeggi
Copy link

Hey JetBrains,
would be awesome if you could merge this!

Cheers

@naiyerasif
Copy link
Contributor Author

@philippnurullin Anything I can do to get this merged? I'd be happy to work on this further if you've any suggestions.

@philippnurullin
Copy link
Member

@naiyerasif Hi, and sorry for the long wait.
It's hard for me to merge this PR because it modifies files I'm not responsible for. The build scripts provided by Google fonts team.
Regarding that, thank you. This is a very useful addition.

@RosaWagner Hi. Can you please look at the build script modifications and validate them?

@RosaWagner
Copy link
Contributor

It's all fine.

@philippnurullin philippnurullin merged commit 2a2595a into JetBrains:master Jan 18, 2023
@philippnurullin
Copy link
Member

@naiyerasif
Made a build with the new script. No files in fonts/variable.

@naiyerasif
Copy link
Contributor Author

@philippnurullin Seems like an issue with the latest job. I can see that the build didn't run fully.

I took the latest changes in my fork and ran the job here to verify if my script is running: https://github.com/naiyerasif/JetBrainsMono/actions/runs/4064950771
If you download the generated font archive, you'll notice that it does contain the variable fonts: https://github.com/naiyerasif/JetBrainsMono/suites/10713117746/artifacts/536769546

@philippnurullin
Copy link
Member

Hi @naiyerasif
I believe that your script is running well in your particular environment.
Unfortunately, in my case it is not working. And I don't have the qualification to fix it. I believe there will be a lot of people like me.

So, I need your help to fix the script and find the solution.
If it is not possible, the script will be removed because the results are not stable.
I'm sorry if this sounds harsh.

@naiyerasif
Copy link
Contributor Author

naiyerasif commented Feb 3, 2023

@philippnurullin Can you please provide me a reproduction of the issue so that I can investigate this? e.g. how are you trying to generate the font? Are you running it on local or on GitHub Actions?

For my demonstration, I pulled the HEAD of this very repository, ran the exact same GitHub Actions workflow that is used officially and the results are available for you to verify: https://github.com/naiyerasif/JetBrainsMono/actions/runs/4064950771

If you're trying to run this on local, you'll have to run gftools first which generates the .ttf files in fonts/variable directory from where my script picks them up for conversion.

# this command generates the files in `fonts/variable` directory
gftools builder sources/config.yaml
# this script picks the `ttf` files from `fonts/variable` directory and converts them to `woff2` files
python scripts/generate_variable_webfonts.py

@philippnurullin
Copy link
Member

Mac OS Ventura 13x
Terminal -bash

  • go to cd .../sources using Terminal.
  • running gftools builder config.yaml
  • running python generate_variable_webfonts.py

The script is running but produce no results.

@philippnurullin
Copy link
Member

Also, run code in IntelliJ IDEA.

Result:

usr.../python3.11
Users...JetBrainsMono/scripts/generate_variable_webfont.py
finished with code 0

Still no new files in /variable

@naiyerasif
Copy link
Contributor Author

naiyerasif commented Feb 6, 2023

This is a path resolution issue. Can you try the following instructions and see if things work?

  • Navigate to …JetBrainsMono (instead of …JetBrainsMono/sources) in Terminal app.
  • Type gftools builder sources/config.yaml in Terminal and run it.
  • Type python scripts/generate_variable_webfonts.py in Terminal and run it to generate variable webfonts.
  • After the scripts are complete, the files can be found in fonts folder.

I've also created a PR #602 with updated instructions. Tested this on Alpine Linux but this should work on other ecosystems as well.

@philippnurullin
Copy link
Member

Thanks. It works!

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.

4 participants