2017-07-26 09:01:04 +02:00
|
|
|
#!/usr/bin/env sh
|
2012-10-02 08:11:04 +02:00
|
|
|
|
2019-07-18 01:46:49 +02:00
|
|
|
set -e
|
|
|
|
|
2020-04-23 10:26:52 +02:00
|
|
|
family=SourceSans3
|
2023-03-24 06:17:55 +01:00
|
|
|
upright_weights=(Black Bold ExtraLight Light Medium Regular Semibold)
|
|
|
|
italic_weights=(BlackIt BoldIt ExtraLightIt LightIt MediumIt It SemiboldIt)
|
2018-09-27 09:09:09 +02:00
|
|
|
|
|
|
|
# get absolute path to bash script
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
2012-10-02 08:11:04 +02:00
|
|
|
|
|
|
|
# clean existing build artifacts
|
2018-09-27 09:09:09 +02:00
|
|
|
rm -rf $DIR/target/
|
|
|
|
otf_dir="$DIR/target/OTF"
|
|
|
|
ttf_dir="$DIR/target/TTF"
|
|
|
|
mkdir -p $otf_dir $ttf_dir
|
|
|
|
|
|
|
|
|
|
|
|
function build_font {
|
2023-03-24 06:17:55 +01:00
|
|
|
# $1 is Upright or Italic
|
2019-01-11 21:06:36 +01:00
|
|
|
# $2 is weight name
|
2018-09-27 09:09:09 +02:00
|
|
|
font_dir=$DIR/$1/Instances/$2
|
|
|
|
font_ufo=$font_dir/font.ufo
|
|
|
|
ps_name=$family-$2
|
|
|
|
echo $ps_name
|
|
|
|
echo "Building OTF ..."
|
|
|
|
# -r is for "release mode" (subroutinization + applied glyph order)
|
|
|
|
# -gs is for filtering the output font to contain only glyphs in the GOADB
|
|
|
|
makeotf -f $font_ufo -r -gs -omitMacNames
|
|
|
|
echo "Building TTF ..."
|
|
|
|
otf2ttf $font_dir/$ps_name.otf
|
|
|
|
echo "Componentizing TTF ..."
|
|
|
|
ttfcomponentizer $font_dir/$ps_name.ttf
|
2012-10-02 08:11:04 +02:00
|
|
|
|
2018-09-27 09:09:09 +02:00
|
|
|
# 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 ""
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-03-24 06:17:55 +01:00
|
|
|
for w in ${upright_weights[@]}
|
2012-10-02 08:11:04 +02:00
|
|
|
do
|
2023-03-24 06:17:55 +01:00
|
|
|
build_font Upright $w
|
2012-10-02 08:11:04 +02:00
|
|
|
done
|
|
|
|
|
2018-09-27 09:09:09 +02:00
|
|
|
|
|
|
|
for w in ${italic_weights[@]}
|
2012-10-02 08:11:04 +02:00
|
|
|
do
|
2018-09-27 09:09:09 +02:00
|
|
|
build_font Italic $w
|
2012-10-02 08:11:04 +02:00
|
|
|
done
|