vascadia: switch to uv
This commit is contained in:
parent
ec4724651d
commit
1248b8ee49
1 changed files with 29 additions and 27 deletions
56
vascadia.sh
56
vascadia.sh
|
@ -1,17 +1,26 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
###
|
###
|
||||||
|
# This script generates an archive with "baked in" stylistic sets
|
||||||
|
# for the best compatibility.
|
||||||
|
###
|
||||||
|
# opentype-feature-freezer is necessary, installed automatically via uv
|
||||||
|
###
|
||||||
# https://github.com/microsoft/cascadia-code
|
# https://github.com/microsoft/cascadia-code
|
||||||
# ss01 - handwritten italic
|
# calt,ss01 - handwritten italic
|
||||||
# ss02 - lua not equals ~=
|
# ss02 - lua not equals ~=
|
||||||
# ss03 - serbian locale
|
# ss03 - serbian locale
|
||||||
# ss19 - slashed zero 0
|
# ss19 - slashed zero 0
|
||||||
# ss20 - graphical control characters
|
# ss20 - graphical control characters
|
||||||
###
|
###
|
||||||
# opentype-feature-freezer is necessary, install with pipx or pip
|
# VARIANT is a find wildcard, so use it wisely
|
||||||
# pip install --upgrade opentype-feature-freezer
|
# e.g. VARIANT='*MonoPL*.otf', VARIANT='*Code*.ttf', VARIANT='*'
|
||||||
###
|
# Font variants:
|
||||||
# This script generates an archive with "baked in" stylistic sets
|
# Code - ligatures, no extras
|
||||||
# for the best compatibility.
|
# Mono - no ligatures, no extras
|
||||||
|
# PL - powerline symbols (CodePL, MonoPL)
|
||||||
|
# NF - powerline + NerdFont symbols (CodeNF, MonoNF)
|
||||||
|
# .ttf - truetype fonts
|
||||||
|
# .otf - opentype fonts
|
||||||
###
|
###
|
||||||
|
|
||||||
VERSION=2407.24
|
VERSION=2407.24
|
||||||
|
@ -19,48 +28,41 @@ VERSION=2407.24
|
||||||
NAME=Vascadia
|
NAME=Vascadia
|
||||||
WDIR=$HOME/vascadia
|
WDIR=$HOME/vascadia
|
||||||
|
|
||||||
SS=ss01,ss02,ss19,ss20
|
SS=calt,ss01,ss19,ss20
|
||||||
|
VARIANT='*MonoPL*.otf'
|
||||||
|
|
||||||
SRC=CascadiaCode-$VERSION.zip
|
SRC=CascadiaCode-$VERSION.zip
|
||||||
URL=https://github.com/microsoft/cascadia-code/releases/download/v$VERSION/$SRC
|
URL=https://github.com/microsoft/cascadia-code/releases/download/v$VERSION/$SRC
|
||||||
|
|
||||||
function prep {
|
function prep {
|
||||||
typeset archive=$WDIR/$SRC
|
[[ -r $SRC ]] || wget $URL
|
||||||
mkdir -p $WDIR
|
unzip $SRC 'otf/**'
|
||||||
[[ -r $archive ]] || wget -P $WDIR $URL
|
uv venv
|
||||||
unzip $archive 'otf/**' -d $WDIR
|
uv pip install opentype-feature-freezer
|
||||||
}
|
|
||||||
|
|
||||||
function venv {
|
|
||||||
typeset venv_dir=$WDIR/.venv
|
|
||||||
python3 -m venv $venv_dir
|
|
||||||
source $venv_dir/bin/activate
|
|
||||||
pip install --upgrade pip opentype-feature-freezer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function convert {
|
function convert {
|
||||||
typeset dst_dir=$WDIR/$NAME
|
mkdir -p $NAME
|
||||||
mkdir -p $dst_dir
|
|
||||||
while read -r src; do
|
while read -r src; do
|
||||||
# an ugly hack to replace C with V, don't judge me
|
dst=$NAME/$(basename ${src//Cascadia/$NAME})
|
||||||
dst=V${src##*/C}
|
|
||||||
|
|
||||||
pyftfeatfreeze -f $SS -R Cascadia/$NAME $src $dst_dir/$dst
|
uv run pyftfeatfreeze -f $SS -R Cascadia/$NAME $src $dst
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup {
|
function cleanup {
|
||||||
typeset source=$WDIR/$NAME
|
typeset source=$NAME
|
||||||
typeset archive=$source-$VERSION.zip
|
typeset archive=$source-$VERSION.zip
|
||||||
zip -rv $archive $source
|
zip -rv $archive $source
|
||||||
rm -rv $source $WDIR/otf
|
rm -rv $source otf
|
||||||
}
|
}
|
||||||
|
|
||||||
function main {
|
function main {
|
||||||
set -ex
|
set -ex
|
||||||
|
mkdir -p $WDIR
|
||||||
|
cd $WDIR
|
||||||
prep
|
prep
|
||||||
venv
|
convert < <(find otf -type f -name $VARIANT)
|
||||||
convert < <(find $WDIR/otf -type f -name '*.otf')
|
|
||||||
cleanup
|
cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue