1
1
mirror of https://github.com/i-tu/Hasklig.git synced 2024-11-04 00:07:38 +03:00
Hasklig/build.sh

67 lines
1.6 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
family=SourceCodePro
2019-06-10 08:36:44 +03:00
roman_weights=(Black Bold ExtraLight Light Medium Regular Semibold)
italic_weights=(BlackIt BoldIt ExtraLightIt LightIt MediumIt It SemiboldIt)
# get absolute path to bash script
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
# clean existing build artifacts
rm -rf "$DIR/target/"
otf_dir="$DIR/target/OTF"
ttf_dir="$DIR/target/TTF"
mkdir -p "$otf_dir" "$ttf_dir"
# path to Python script that adds the SVG table
2019-06-10 08:36:44 +03:00
addSVG="$DIR"/addSVGtable.py
# path to UVS file
2019-06-10 08:36:44 +03:00
UVS="$DIR"/uvs.txt
2019-06-10 08:36:44 +03:00
function build_font {
# $1 is Roman or Italic
# $2 is weight name
font_dir="$DIR"/$1/Instances/$2
font_ufo="$font_dir"/font.ufo
font_ttf="$font_dir"/font.ttf
ps_name=$family-$2
echo $ps_name
echo "Building OTF ..."
# -r is for "release mode" (subroutinization + applied glyph order)
makeotf -f "$font_ufo" -r -ci "$UVS"
echo "Building TTF ..."
makeotf -f "$font_ttf" -r -ci "$UVS" -ff "$font_ufo"/features.fea
echo "Adding SVG table ..."
"$addSVG" "$font_dir"/$ps_name.otf "$DIR"/svg
# copy SVG and DSIG tables from OTF to TTF
sfntedit -x DSIG="$font_dir"/.tb_DSIG,SVG="$font_dir"/.tb_SVG "$font_dir"/$ps_name.otf
sfntedit -a DSIG="$font_dir"/.tb_DSIG,SVG="$font_dir"/.tb_SVG "$font_dir"/$ps_name.ttf
# delete build artifacts
rm "$font_dir"/.tb_*
# move font files to target directory
mv "$font_dir"/$ps_name.otf "$otf_dir"
mv "$font_dir"/$ps_name.ttf "$ttf_dir"
echo "Done with $ps_name"
echo ""
echo ""
}
for w in ${roman_weights[@]}
do
2019-06-10 08:36:44 +03:00
build_font Roman $w
done
2015-06-05 03:59:51 +03:00
2019-06-10 08:36:44 +03:00
for w in ${italic_weights[@]}
2015-06-05 03:59:51 +03:00
do
2019-06-10 08:36:44 +03:00
build_font Italic $w
2015-06-05 03:59:51 +03:00
done