Removed binaries from git, fixed variable + Retina, added version to CI

This commit is contained in:
Nikita Prokopov 2021-08-09 02:26:47 +02:00
parent f1f9767998
commit 6bf3854628
31 changed files with 78 additions and 119 deletions

View File

@ -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
.gitignore vendored
View File

@ -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 not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

4
script/bootstrap_action → script/bootstrap_linux.sh Normal file → Executable file
View File

@ -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

View File

@ -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

View File

@ -1,90 +0,0 @@
#!/bin/bash -e
[ -d venv ] && source venv/bin/activate
# ============================================================================
# VARIABLE FONT ==============================================================
# variable font
firaCodeVF=distr/variable_ttf/FiraCode-VF.ttf
rm -rf $firaCodeVF
fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf
# fix variable font metadata very important
gftools fix-vf-meta $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF
# other fixes for metadata and hinting
gftools fix-nonhinting $firaCodeVF $firaCodeVF
gftools fix-gasp --autofix $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF
gftools fix-dsig --autofix $firaCodeVF
# cleanup of temp files
rm -rf distr/variable_ttf/*-gasp*
# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)
# ============================================================================
# STATIC FONTS ===============================================================
rm -rf distr/ttf
fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf -i
rm -rf distr/otf
fontmake -g FiraCode.glyphs -o otf --output-dir distr/otf -i
# -------------------------------------------------------------
# Autohinting -------------------------------------------------
statics=$(ls distr/ttf/*.ttf)
for file in $statics; do
echo "fix DSIG in " ${file}
gftools fix-dsig --autofix ${file}
echo "TTFautohint " ${file}
# autohint with detailed info
hintedFile=${file/".ttf"/"-hinted.ttf"}
ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn --composites --windows-compatibility
cp ${hintedFile} ${file}
rm -rf ${hintedFile}
done
# ============================================================================
# Build woff2 fonts ==========================================================
# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)
rm -rf distr/woff2
ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
woff2_compress $ttf
done
mkdir -p distr/woff2
woff2s=$(ls distr/*/*.woff2)
for woff2 in $woff2s; do
mv $woff2 distr/woff2/$(basename $woff2)
done
# ============================================================================
# Build woff fonts ===========================================================
# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)
rm -rf distr/woff
ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
sfnt2woff-zopfli $ttf
done
mkdir -p distr/woff
woffs=$(ls distr/*/*.woff)
for woff in $woffs; do
mv $woff distr/woff/$(basename $woff)
done

8
script/build.sh Executable file
View File

@ -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

View File

@ -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" )

View File

@ -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
@ -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

View File

@ -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

View File

@ -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

8
script/clean.sh Executable file
View File

@ -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
script/version.py Executable file
View File

@ -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("Cant parse revision: " + desc)
if __name__ == '__main__':
print(revision())
sys.exit(0)