From 3b88c967426f23908e63ad44ed78478bd63c1fa1 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 16 Oct 2024 18:00:17 +0300 Subject: [PATCH] Add making OTF into build pipeline --- script/build.sh | 1 + script/build_otf.sh | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 script/build_otf.sh diff --git a/script/build.sh b/script/build.sh index 1de2324955..4a274722a0 100755 --- a/script/build.sh +++ b/script/build.sh @@ -94,6 +94,7 @@ if [ "${gen_glyphs_file_only}" -ne 0 ]; then exit 0 fi +./build_otf.sh "${weights[@]}" ./build_ttf.sh "${weights[@]}" ./build_variable.sh ./build_woff2.sh diff --git a/script/build_otf.sh b/script/build_otf.sh new file mode 100755 index 0000000000..c149c651ac --- /dev/null +++ b/script/build_otf.sh @@ -0,0 +1,27 @@ +#!/bin/bash +set -o errexit -o nounset -o pipefail +cd "$(dirname "$0")/.." +[ -d venv ] && source venv/bin/activate + +family_name=${FIRACODE_FAMILY_NAME:-"Fira Code"} +glyphs_file=${FIRACODE_GLYPHS_FILE:-"FiraCode.glyphs"} + +dir="distr/otf/${family_name}" + +mkdir -p "${dir}" +rm -rf "${dir:?}/"* + +args=( "$@" ) +default_weights=( "Light" "Regular" "Retina" "Medium" "SemiBold" "Bold" ) +weights=( "${args[@]:-"${default_weights[@]}"}" ) + +for weight in "${weights[@]}"; do + file="${dir}/FiraCode-${weight}.otf" + + echo "==============" + echo + echo " [i] Creating ${file}" + echo + + fontmake -g "${glyphs_file}" -o otf --output-path "${file}" -i ".* ${weight}" +done