feat: allow hardcoding of features via arguments to build script #1387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces several flags to the build script that allows users to bake ligatures directly into the font and thus enabling them permanently. This is useful for those who want to use certain style sets or character variations in editors that otherwise don't allow for such features.
How can it be used?
Features to be baked in can be given to build.sh as a comma separated list with the
-f / --features
flag.All features that were not already in their own files were pulled out of FiraCode.glyphs into individual files. There is no way I will write a parser for the glyphs file to do that at runtime. The build script will then read the code in these feature files and appends it to the
calt
property inside the glyphs file.To more easily generate multiple font versions with different features baked in, there are flags
-n / --family-name
for build.sh that will allow users to set a custom family name for the font. The special value "features" will append the feature list to the font name. The family name is exported and used by the other build scripts as a directory to separate different font versions. The filenames were not changed, the directory name is enough separation.Via another flag,
-w / --weights
, a comma separated list of font weights to be generated can be given to build.sh. This was already possible by specifying font weights as separate arguments to build_ttf.sh but now they can be given to the overall automated build script as well.The flag
-g / --generate-glyphs-only
will cause the script to exit after the custom glyphs file has been created without actually building the font. I personally use this to generate a glyphs file I can then use with EzequielRamis/liga to patch other fonts with FiraCode's ligatures.Note for the future
This implementation relies on the code for all features being inside a file called
./features/{name}.fea
where{name}
is the feature name, i.e. the code for the ss06 feature must be inside a file called features/ss06.fea. If that code contains lookups, those brackets must be on separate lines. Furthermore, the file must not contain inline comments (I don't know if these would be allowed in the first place). This is because all collected code blocks will be put on a single line.This is ok:
1. These are all NOT ok:
Closes #1383
Closes #1348
Related, close at your own discretion:
Requested different style binaries