google/fonts directly.
This is the process the Packager is able to automate:
tag release, which is quite practical.gftools_packager_ofl_fontname.ofl directory. If the font is an upgrade, it updates the existing directory with the new elements.Makes a Pull Request to google/fonts on a branch of the same name, and write the required description in comment:
Taken from the upstream repo <repo-url> at commit <commit-url>.
Once the font family has been packaged once with the Packager (and that PR has been merged), packager will be able to update the font in google/fonts repo very easily. It will use the source information included in the METADATA.pb file and an endpoint location in google/fonts repo to speed up the entire process.
Note that the font has to be in the same location as before, otherwise you would have to correct METADATA.pb first.
The Packager needs information about the font project as well as to know where to find the necessary files (fonts, OFL, etc.), so we need to provide that info in the METADATA.pb file. Open your terminal and run:
gftools packager "Font Name" path/to/local/google/fonts
This will create a gftools_packager_ofl_fontname branch; the ofl/fontname directory for the project with a METADATA.pb file draft. You will have to fill in all needed information indirectly from the Terminal using vim or your favorite code editor.
To fill out the Metadata file, it is not necessary to checkout the gftools branch: do it from the main branch of your local copy of the google/fonts repo.
Otherwise, if you are going to modify any of the files included in the package, please first checkout the gftools_packager_ofl_fontname branch, then modify the files from there.
At the end, you should have this kind of information (refer to the Metadata section of this Guide to fin more details about the required fields):
name: "Font Name"
designer: "Foundry Name, Designer Name 1, Designer Name 2"
license: "OFL"
category: "MONOSPACE" # Make sure to type the right category for the font project
date_added: "2024-06-13" # It is automatically added by the tool.
source {
repository_url: "https://github.com/MyAccount/MyProject"
files {
source_file: "OFL.txt"
dest_file: "OFL.txt"
}
files {
source_file: "fonts/variable/FontName.ttf"
dest_file: "FontName.ttf"
}
files {
source_file: "documentation/article/ARTICLE.en_us.html"
dest_file: "article/ARTICLE.en_us.html"
}
files {
source_file: "documentation/about/font-image1.png"
dest_file: "arti/font-image1.png"
}
branch: "main"
}
subsets: "latin"
subsets: "math"
subsets: "menu" # This subset is mandatory for all the fonts and it's automatically added by the tool.
stroke: "SANS_SERIF" # Make sure to type the right stroke for the font project
classifications: "DISPLAY" # Make sure to type the right classification for the font project
→ In files field the source_file is the file path for the files in the upstream repo, and the dest_file is the target file and location in ofl/fontname directory of google/fonts repository.
→ This example above works if the upstream repository has a fonts directory where the binaries are stored. If the fonts are in a zip file of a tagged release, and not in a font directory, then you should use the archive_url field this way:
repository_url: https://github.com/owner/Font-Name
archive_url: https://github.com/{owner}/{repo}/releases/download/{version}/project-name.zip
branch: main
→ You obtain the link of the zip by right-clicking on it from the upstream repo.
Once the METADATA.pb file has been filled out with all the required information, you can run the tool again, adding the -p option, which makes a pull request to Google Fonts:
gftools packager "Font Name" path/to/local/google/fonts -p
The Packager will package all the files from the font’s upstream repository, commit, and push them onto a new branch in the google/fonts repo.
ofl folder (of the main branch) if the METADATA.pb already contains the required information and that it is well set up. If not, update it following the above specifications.
If yes, run this command to create the PR: gftools packager "Font Name" path/to/local/google-fonts-repo -p.
If you need to modify any file included in the package, checkout the gftools_packager_ofl_fontname branch and modify them from there. For example, if you haven’t done it directly in the upstream repo, update the DESCRIPTION.en_us.html or ARTICLE.en_us.html and commit in the branch that the Packager created.
Checkout the main branch of your local copy of the google/fonts repo and run the command ``gftools packager “Font Name” path/to/local/google-fonts-repo -p` again to update the PR with the added changes.
If you use the previous method, and if you want to modify your PR, every time you run -p argument in conjunction with a “font name”, you will actually re-package and override the PR (because it will ask you to do a force-push). This means that all your manual commits you may have done in between will be lost.
To avoid that, you can first run it without -p to package and, in a second step, use -p.
Also, keep in mind that every push you make on a google/fonts PR will trigger the Continuous Integration (CI) workflow which generate QA reports. If the CI is triggered multiple times at once, it can happen that the CI workflow breaks. It is therefore wise to make all modifications to METADATA.pb and ARTICLE.html beforehand, and push all the changes at once.