diff --git a/vascadia.sh b/vascadia.sh new file mode 100755 index 0000000..123b7bf --- /dev/null +++ b/vascadia.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env zsh +### +# https://github.com/microsoft/cascadia-code +# ss01 - handwritten italic +# ss02 - lua not equals ~= +# ss03 - serbian locale +# ss19 - slashed zero 0 +# ss20 - graphical control characters +### +# opentype-feature-freezer is necessary, install with pipx or pip +# pip install --upgrade opentype-feature-freezer +### +# This script generates an archive with "baked in" stylistic sets +# for the best compatibility. +### + +VERSION=2407.24 + +NAME=Vascadia +WDIR=$HOME/vascadia + +SS=ss01,ss02,ss19,ss20 + +SRC=CascadiaCode-$VERSION.zip +URL=https://github.com/microsoft/cascadia-code/releases/download/v$VERSION/$SRC + +function prep { + typeset archive=$WDIR/$SRC + mkdir -p $WDIR + [[ -r $archive ]] || wget -P $WDIR $URL + unzip $archive 'otf/**' -d $WDIR +} + +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 { + typeset dst_dir=$WDIR/$NAME + mkdir -p $dst_dir + while read -r src; do + # an ugly hack to replace C with V, don't judge me + dst=V${src##*/C} + + pyftfeatfreeze -f $SS -R Cascadia/$NAME $src $dst_dir/$dst + done +} + +function cleanup { + typeset source=$WDIR/$NAME + typeset archive=$source-$VERSION.zip + zip -rv $archive $source + rm -rv $source $WDIR/otf +} + +function main { + set -ex + prep + venv + convert < <(find $WDIR/otf -type f -name '*.otf') + cleanup +} + +main $@ diff --git a/vcascadia-gen.sh b/vcascadia-gen.sh deleted file mode 100755 index 83577ed..0000000 --- a/vcascadia-gen.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env zsh -### -# https://github.com/microsoft/cascadia-code -# ss01 - handwritten italic -# ss02 - lua not equals ~= -# ss03 - serbian locale -# ss19 - slashed zero 0 -# ss20 - graphical control characters -### -# opentype-feature-freezer is necessary, install with pipx or pip -# pip install --upgrade opentype-feature-freezer -### - -name=VascadiaMod -arch=$name.tgz -ss=ss01,ss19,ss20 - -for font in CascadiaMonoNF*.otf; do - src=$font - dst=${font/CascadiaMonoNF/$name} - - pyftfeatfreeze -f $ss -R "Cascadia Code PL/$name" $src $dst -done - -eval tar -acvf $arch $name*