Skip to content

Commit

Permalink
Removed binaries from git, fixed variable + Retina, added version to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
tonsky committed Aug 9, 2021
1 parent f1f9767 commit 6bf3854
Show file tree
Hide file tree
Showing 31 changed files with 78 additions and 119 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ jobs:
runs-on: ubuntu-latest
name: Build
steps:
- name: Checkout the latest commit
uses: actions/checkout@v2
- name: Install dependencies
run: bash -ex ./script/bootstrap_action
- name: Build fonts
run: bash -e ./script/build
- name: Upload built fonts
uses: actions/upload-artifact@v2
- uses: actions/checkout@v2
- run: echo "FIRA_CODE_VERSION=$(python3 ./script/version.py)" >> $GITHUB_ENV
- run: ./script/bootstrap_linux.sh
- run: ./script/build.sh
- uses: actions/upload-artifact@v2
with:
name: Fira_Code
name: Fira_Code_v${{ env.FIRA_CODE_VERSION }}
path: distr
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ FiraCode_mess.glyphs
target
clojure/*.edn
FiraCode\ (Autosaved).glyphs
FiraCode_VF.glyphs
.cpcache
master_ufo
instance_ufo
venv
.DS_Store
*.numbers
*.numbers
distr/ttf
distr/otf
distr/woff
distr/woff2
distr/variable_ttf
Binary file removed distr/ttf/FiraCode-Bold.ttf
Binary file not shown.
Binary file removed distr/ttf/FiraCode-Light.ttf
Binary file not shown.
Binary file removed distr/ttf/FiraCode-Medium.ttf
Binary file not shown.
Binary file removed distr/ttf/FiraCode-Regular.ttf
Binary file not shown.
Binary file removed distr/ttf/FiraCode-Retina.ttf
Binary file not shown.
Binary file removed distr/ttf/FiraCode-SemiBold.ttf
Binary file not shown.
Binary file removed distr/variable_ttf/FiraCode-VF.ttf
Binary file not shown.
Binary file removed distr/woff/FiraCode-Bold.woff
Binary file not shown.
Binary file removed distr/woff/FiraCode-Light.woff
Binary file not shown.
Binary file removed distr/woff/FiraCode-Medium.woff
Binary file not shown.
Binary file removed distr/woff/FiraCode-Regular.woff
Binary file not shown.
Binary file removed distr/woff/FiraCode-SemiBold.woff
Binary file not shown.
Binary file removed distr/woff/FiraCode-VF.woff
Binary file not shown.
Binary file removed distr/woff2/FiraCode-Bold.woff2
Binary file not shown.
Binary file removed distr/woff2/FiraCode-Light.woff2
Binary file not shown.
Binary file removed distr/woff2/FiraCode-Medium.woff2
Binary file not shown.
Binary file removed distr/woff2/FiraCode-Regular.woff2
Binary file not shown.
Binary file removed distr/woff2/FiraCode-SemiBold.woff2
Binary file not shown.
Binary file removed distr/woff2/FiraCode-VF.woff2
Binary file not shown.
4 changes: 3 additions & 1 deletion script/bootstrap_action → script/bootstrap_linux.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /bin/bash -ex
#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."

sudo apt update
sudo apt install -y python3.8 python3-setuptools python3.8-dev pkg-config zlib1g ttfautohint woff2 sfnt2woff-zopfli
Expand Down
4 changes: 3 additions & 1 deletion script/bootstrap → script/bootstrap_macos.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#! /bin/bash -ex
#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."

sudo easy_install-3.8 pip
pip install virtualenv --user
Expand Down
90 changes: 0 additions & 90 deletions script/build

This file was deleted.

8 changes: 8 additions & 0 deletions script/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`"

./build_ttf.sh
./build_variable.sh
./build_woff2.sh
./build_woff.sh
7 changes: 5 additions & 2 deletions script/build_ttf → script/build_ttf.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/bin/bash -euo pipefail

#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."
[ -d venv ] && source venv/bin/activate
mkdir -p distr/ttf
rm -rf distr/ttf/*

args=( "$@" )
default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" )
Expand Down
17 changes: 10 additions & 7 deletions script/build_variable → script/build_variable.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/bin/bash -euo pipefail

#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."

[ -d venv ] && source venv/bin/activate
mkdir -p distr/variable_ttf
rm -rf distr/variable_ttf/*

DIR=distr/variable_ttf
FILE=FiraCode-VF.ttf

rm -rf $DIR/$FILE
fontmake -g FiraCode.glyphs -o variable --output-dir $DIR
awk '/name = Retina;/ { print; print "exports = 0;"; next }1' FiraCode.glyphs > FiraCode_VF.glyphs
fontmake -g FiraCode_VF.glyphs -o variable --output-dir distr/variable_ttf
rm FiraCode_VF.glyphs

cd distr/variable_ttf
pushd distr/variable_ttf

# fix variable font metadata – very important
gftools fix-vf-meta $FILE
Expand All @@ -29,3 +30,5 @@ gftools fix-dsig --autofix $FILE
rm -rf *-gasp.ttf

# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)

popd
9 changes: 5 additions & 4 deletions script/build_woff → script/build_woff.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash -euo pipefail
# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)

#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."
[ -d venv ] && source venv/bin/activate
mkdir -p distr/woff
rm -rf distr/woff/*

rm -rf distr/*/*.woff
# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)

ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
Expand Down
9 changes: 5 additions & 4 deletions script/build_woff2 → script/build_woff2.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/bash -euo pipefail
# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)

#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."
[ -d venv ] && source venv/bin/activate
mkdir -p distr/woff2
rm -rf distr/woff2/*

rm -rf distr/*/*.woff2
# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)

ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
Expand Down
8 changes: 8 additions & 0 deletions script/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash
set -o errexit -o nounset -o pipefail
cd "`dirname $0`/.."

rm -rf distr/ttf
rm -rf distr/variable_ttf
rm -rf distr/woff2
rm -rf distr/woff
18 changes: 18 additions & 0 deletions script/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#! /usr/bin/env python3

import os, re, subprocess, sys

def revision():
os.chdir(os.path.abspath(os.path.dirname(__file__) + '/..'))
desc = subprocess.check_output(["git", "describe", "--tags"], cwd = os.path.dirname(__file__)).decode("utf-8")
match = re.match("([0-9.]+)-([0-9]+)-[a-z0-9]+", desc)
if match:
return match.group(1) + "." + match.group(2)
match = re.match("([0-9]+.[0-9]+).0", desc)
if match:
return match.group(1) + ".0"
raise Exception("Can’t parse revision: " + desc)

if __name__ == '__main__':
print(revision())
sys.exit(0)

0 comments on commit 6bf3854

Please sign in to comment.