iosevka-prog-font-builder/build-iosevka-prog-font.sh

52 lines
2.2 KiB
Bash
Raw Normal View History

2021-12-13 08:13:23 +00:00
#!/bin/bash
set -e
2024-06-24 10:20:50 +00:00
IOSEVKA_VERSION=30.3.0
FONT_NAME=IosevkaProg
2021-12-13 08:13:23 +00:00
FILE=$( readlink -f "${BASH_SOURCE[0]}" )
2023-01-12 07:52:55 +00:00
DIR=$( dirname "${FILE}" )
DIST="${DIR}/dist"
2024-06-24 10:20:50 +00:00
OBLIQUE="${DIST}/Oblique"
REGULAR="${DIST}/Regular"
2021-12-13 08:13:23 +00:00
CONFIG="${DIR}/private-build-plans.toml"
2024-06-24 10:20:50 +00:00
OUT_DIR="${DIST}/${FONT_NAME}/TTF"
2021-12-13 08:13:23 +00:00
if [ -r "${CONFIG}" ]; then
2023-01-12 07:52:55 +00:00
if command -v docker >/dev/null 2>&1; then
2024-06-24 10:20:50 +00:00
wget -c https://github.com/be5invis/Iosevka/archive/refs/tags/v${IOSEVKA_VERSION}.tar.gz
tar axf v${IOSEVKA_VERSION}.tar.gz
pushd Iosevka-${IOSEVKA_VERSION}/docker
docker build -t=iosevka-builder .
popd
rm -rf Iosevka-${IOSEVKA_VERSION} v${IOSEVKA_VERSION}.tar.gz
docker pull cdalvaro/docker-nerd-fonts-patcher:latest
docker run -e FONT_VERSION="${IOSEVKA_VERSION}" -it -v "$DIR":/work iosevka-builder ttf::${FONT_NAME}
sudo chown -R "$(id -u)":"$(id -g)" "${DIST}"
mkdir -p "${OBLIQUE}"
2024-06-24 10:20:50 +00:00
cp -af "${OUT_DIR}/${FONT_NAME}-Oblique.ttf" "${OBLIQUE}"
2023-07-24 12:03:27 +00:00
docker run --rm -v "${OBLIQUE}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --adjust-line-height --makegroups 1
mkdir -p "${REGULAR}"
2024-06-24 10:20:50 +00:00
cp -af "${OUT_DIR}/${FONT_NAME}-Regular.ttf" "${REGULAR}"
2023-07-24 12:03:27 +00:00
docker run --rm -v "${REGULAR}":/in -v "${OUT_DIR}":/out nerdfonts/patcher --complete --adjust-line-height --makegroups 1 --mono --removeligatures
sudo chown -R "$(id -u)":"$(id -g)" "${DIST}"
2023-04-24 07:52:09 +00:00
cd "${OUT_DIR}"
2023-07-24 12:03:27 +00:00
python3 "${DIR}/fontname.py" "Iosevka Prog Nerd Font" IosevkaProgNerdFont-Oblique.ttf
python3 "${DIR}/fontname.py" "Iosevka Prog Nerd Font Mono" IosevkaProgNerdFontMono-Regular.ttf
mkdir -p "iosevka-prog-nerd-$IOSEVKA_VERSION"
mv Iosevka*Nerd*ttf "iosevka-prog-nerd-$IOSEVKA_VERSION"
2023-08-05 05:19:20 +00:00
tar acf "${DIST}/iosevka-prog-nerd-${IOSEVKA_VERSION}.tar.xz" "iosevka-prog-nerd-$IOSEVKA_VERSION"
2023-07-24 12:03:27 +00:00
mkdir -p "iosevka-prog-$IOSEVKA_VERSION"
2024-06-24 10:20:50 +00:00
mv Iosevka*ttf "iosevka-prog-$IOSEVKA_VERSION"
2023-08-05 05:19:20 +00:00
tar acf "${DIST}/iosevka-prog-${IOSEVKA_VERSION}.tar.xz" "iosevka-prog-$IOSEVKA_VERSION"
cd "${DIST}"
ln -s "iosevka-prog-nerd-${IOSEVKA_VERSION}.tar.xz" "fonts-iosevka-prog-nerd_${IOSEVKA_VERSION}.orig.tar.xz"
ln -s "iosevka-prog-${IOSEVKA_VERSION}.tar.xz" "fonts-iosevka-prog_${IOSEVKA_VERSION}.orig.tar.xz"
2021-12-13 08:13:23 +00:00
else
echo "Docker executable not found"
fi
else
echo "Can't read config file ${CONFIG}"
fi