Skip to content

Instantly share code, notes, and snippets.

@chapko
Created May 29, 2023 06:56
Show Gist options
  • Save chapko/c545f7d7bbad488d61c7a8cd0d9a9157 to your computer and use it in GitHub Desktop.
Save chapko/c545f7d7bbad488d61c7a8cd0d9a9157 to your computer and use it in GitHub Desktop.
Fira Code built with custom features
pkgname=ttf-firacode-nerd-qeteq
_nfver=3.0.1
pkgver=582.ee125da
pkgrel=1
pkgdesc="Fira Code, patched with the Nerd Fonts Patcher and custom features"
arch=('any')
url='https://github.com/tonsky/FiraCode'
license=('custom:OFL')
makedepends=(
'git' 'ttfautohint' 'python' 'pyenv' 'python-virtualenv'
'unzip' 'fontforge'
)
source=(
"git+https://github.com/tonsky/FiraCode.git#branch=master"
"font-patcher-$_nfver::https://raw.githubusercontent.com/ryanoasis/nerd-fonts/v$_nfver/FontPatcher.zip"
"ttf-only.patch"
)
sha256sums=(
'SKIP'
'c1d7a1d4d600e3d312c57cda55fbb048bdf731dbb1b2e3dab4d64643df411b3b'
'SKIP'
)
#
_fira_features=(
'cv01' # 'a' variant
'cv31' # round parentheses
'ss08' # separated equal signs == === != !==
)
_fira_weights=(
'Light'
'Regular'
'Medium'
'SemiBold'
'Bold'
)
pkgver() {
cd "${srcdir}/FiraCode"
printf "%s.%s" "$(git rev-parse --short HEAD)" "${_nfver}"
}
prepare() {
cd "${srcdir}/FiraCode"
patch --forward --strip=1 --input="${srcdir}/ttf-only.patch"
}
_comma_list() { local IFS=","; echo "$*"; }
build() {
# build font
cd "${srcdir}/FiraCode"
# need system site-packages for fontforge
virtualenv --system-site-packages venv
source venv/bin/activate
pip install --upgrade Pillow==5.4.1 idna==2.8 requests==2.21.0 urllib3==1.24.1 pycairo==1.20.1 gftools==0.7.4 fontmake==2.4.0 fontbakery==0.8.0
./script/build.sh \
--features "$(_comma_list "${_fira_features[@]}")" \
--weights "$(_comma_list "${_fira_weights[@]}")" \
# patch font
mkdir -p "${srcdir}/patched"
for f in "${srcdir}/FiraCode/distr/ttf/Fira Code"/*.ttf; do
python "${srcdir}/font-patcher" -q -c "$f" -out "${srcdir}/patched"
done
}
package() {
cd "${srcdir}/patched"
install -Dd "${pkgdir}/usr/share/fonts/TTF"
install -Dm644 ./*.ttf "$pkgdir/usr/share/fonts/TTF/"
}
--- FiraCode/script/build.sh 2023-05-28 01:54:11.139745268 +0400
+++ FiraCode/script/build.sh 2023-05-28 01:54:54.691077968 +0400
@@ -95,8 +95,5 @@
fi
./build_ttf.sh "${weights[@]}"
-./build_variable.sh
-./build_woff2.sh
-./build_woff.sh
rm -f "${FIRACODE_GLYPHS_FILE}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment