JetBrains / JetBrainsMono

JetBrains Mono – the free and open-source typeface for developers
https://jetbrains.com/mono
SIL Open Font License 1.1
10.58k stars 298 forks source link

Generate variable webfonts #535

Closed naiyerasif closed 1 year ago

naiyerasif commented 2 years ago

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 commented 1 year ago

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

Cheers

naiyerasif commented 1 year ago

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

philippnurullin commented 1 year ago

@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 commented 1 year ago

It's all fine.

philippnurullin commented 1 year ago

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

naiyerasif commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Mac OS Ventura 13x Terminal -bash

The script is running but produce no results.

philippnurullin commented 1 year ago

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 commented 1 year ago

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

I've also created a PR https://github.com/JetBrains/JetBrainsMono/pull/602 with updated instructions. Tested this on Alpine Linux but this should work on other ecosystems as well.

philippnurullin commented 1 year ago

Thanks. It works!