Update build scripts
This commit is contained in:
parent
179f296d7e
commit
db570b60e6
75
build.sh
75
build.sh
|
@ -1,35 +1,64 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
family=SourceCodePro
|
family=SourceCodePro
|
||||||
romanWeights='Black Bold ExtraLight Light Medium Regular Semibold'
|
roman_weights=(Black Bold ExtraLight Light Medium Regular Semibold)
|
||||||
italicWeights='BlackIt BoldIt ExtraLightIt LightIt MediumIt It SemiboldIt'
|
italic_weights=(BlackIt BoldIt ExtraLightIt LightIt MediumIt It SemiboldIt)
|
||||||
|
|
||||||
# path to Python script that adds the SVG table
|
# get absolute path to bash script
|
||||||
addSVG=$(cd $(dirname "$0") && pwd -P)/addSVGtable.py
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
|
||||||
# path to UVS file
|
|
||||||
UVS=$(cd $(dirname "$0") && pwd -P)/uvs.txt
|
|
||||||
|
|
||||||
# clean existing build artifacts
|
# clean existing build artifacts
|
||||||
rm -rf target/
|
rm -rf "$DIR/target/"
|
||||||
otfDir="target/OTF"
|
otf_dir="$DIR/target/OTF"
|
||||||
ttfDir="target/TTF"
|
ttf_dir="$DIR/target/TTF"
|
||||||
mkdir -p $otfDir $ttfDir
|
mkdir -p "$otf_dir" "$ttf_dir"
|
||||||
|
|
||||||
for w in $romanWeights
|
# path to Python script that adds the SVG table
|
||||||
|
addSVG="$DIR"/addSVGtable.py
|
||||||
|
|
||||||
|
# path to UVS file
|
||||||
|
UVS="$DIR"/uvs.txt
|
||||||
|
|
||||||
|
|
||||||
|
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
|
do
|
||||||
font_path=Roman/Instances/$w/font
|
build_font Roman $w
|
||||||
makeotf -f $font_path.ufo -r -ci "$UVS" -o $otfDir/$family-$w.otf
|
|
||||||
makeotf -f $font_path.ttf -r -ci "$UVS" -o $ttfDir/$family-$w.ttf -ff $font_path.ufo/features.fea
|
|
||||||
"$addSVG" $otfDir/$family-$w.otf svg
|
|
||||||
"$addSVG" $ttfDir/$family-$w.ttf svg
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for w in $italicWeights
|
|
||||||
|
for w in ${italic_weights[@]}
|
||||||
do
|
do
|
||||||
font_path=Italic/Instances/$w/font
|
build_font Italic $w
|
||||||
makeotf -f $font_path.ufo -r -ci "$UVS" -o $otfDir/$family-$w.otf
|
|
||||||
makeotf -f $font_path.ttf -r -ci "$UVS" -o $ttfDir/$family-$w.ttf -ff $font_path.ufo/features.fea
|
|
||||||
"$addSVG" $otfDir/$family-$w.otf svg
|
|
||||||
"$addSVG" $ttfDir/$family-$w.ttf svg
|
|
||||||
done
|
done
|
||||||
|
|
98
buildVFs.sh
98
buildVFs.sh
|
@ -1,55 +1,69 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
# path to Python script that adds the SVG table
|
|
||||||
addSVG=$(cd $(dirname "$0") && pwd -P)/addSVGtable.py
|
|
||||||
|
|
||||||
# path to UVS file
|
|
||||||
UVS=$(cd $(dirname "$0") && pwd -P)/uvs.txt
|
|
||||||
|
|
||||||
rom=Roman/Masters
|
|
||||||
itm=Italic/Masters
|
|
||||||
|
|
||||||
ro_name=SourceCodeVariable-Roman
|
ro_name=SourceCodeVariable-Roman
|
||||||
it_name=SourceCodeVariable-Italic
|
it_name=SourceCodeVariable-Italic
|
||||||
|
|
||||||
# build variable OTFs
|
# get absolute path to bash script
|
||||||
buildmasterotfs --mkot -ci,"$UVS" $rom/$ro_name.designspace
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
buildcff2vf $rom/$ro_name.designspace
|
|
||||||
buildmasterotfs --mkot -ci,"$UVS" $itm/$it_name.designspace
|
|
||||||
buildcff2vf $itm/$it_name.designspace
|
|
||||||
|
|
||||||
# extract and subroutinize the CFF2 table
|
# clean existing build artifacts
|
||||||
echo 'Subroutinizing' $rom/$ro_name.otf
|
var_dir="$DIR"/target/VAR
|
||||||
tx -cff2 +S +b -std $rom/$ro_name.otf $rom/.tb_cff2 2> /dev/null
|
rm -rf "$var_dir"
|
||||||
echo 'Subroutinizing' $itm/$it_name.otf
|
mkdir -p "$var_dir"
|
||||||
tx -cff2 +S +b -std $itm/$it_name.otf $itm/.tb_cff2 2> /dev/null
|
|
||||||
|
|
||||||
# replace CFF2 table with subroutinized version
|
# path to Python script that adds the SVG table
|
||||||
sfntedit -a CFF2=$rom/.tb_cff2 $rom/$ro_name.otf 1> /dev/null
|
addSVG="$DIR"/addSVGtable.py
|
||||||
sfntedit -a CFF2=$itm/.tb_cff2 $itm/$it_name.otf 1> /dev/null
|
|
||||||
|
|
||||||
# add SVG table to variable OTFs
|
# path to UVS file
|
||||||
"$addSVG" $rom/$ro_name.otf svg
|
UVS="$DIR"/uvs.txt
|
||||||
"$addSVG" $itm/$it_name.otf svg
|
|
||||||
|
|
||||||
# build variable TTFs
|
|
||||||
fontmake -m $rom/$ro_name.designspace -o variable --production-names
|
|
||||||
fontmake -m $itm/$it_name.designspace -o variable --production-names
|
|
||||||
|
|
||||||
# use cmap, DSIG, name, OS/2, hhea, post, SVG, and STAT tables from OTFs
|
function build_var_font {
|
||||||
sfntedit -x cmap=$rom/.tb_cmap,DSIG=$rom/.tb_DSIG,name=$rom/.tb_name,OS/2=$rom/.tb_os2,hhea=$rom/.tb_hhea,post=$rom/.tb_post,SVG=$rom/.tb_SVG,STAT=$rom/.tb_STAT $rom/$ro_name.otf 1> /dev/null
|
# $1 is Master directory
|
||||||
sfntedit -a cmap=$rom/.tb_cmap,DSIG=$rom/.tb_DSIG,name=$rom/.tb_name,OS/2=$rom/.tb_os2,hhea=$rom/.tb_hhea,post=$rom/.tb_post,SVG=$rom/.tb_SVG,STAT=$rom/.tb_STAT $rom/$ro_name.ttf 1> /dev/null
|
# $2 is font name
|
||||||
sfntedit -x cmap=$itm/.tb_cmap,DSIG=$itm/.tb_DSIG,name=$itm/.tb_name,OS/2=$itm/.tb_os2,hhea=$itm/.tb_hhea,post=$itm/.tb_post,SVG=$itm/.tb_SVG,STAT=$itm/.tb_STAT $itm/$it_name.otf 1> /dev/null
|
echo $2
|
||||||
sfntedit -a cmap=$itm/.tb_cmap,DSIG=$itm/.tb_DSIG,name=$itm/.tb_name,OS/2=$itm/.tb_os2,hhea=$itm/.tb_hhea,post=$itm/.tb_post,SVG=$itm/.tb_SVG,STAT=$itm/.tb_STAT $itm/$it_name.ttf 1> /dev/null
|
|
||||||
|
|
||||||
# use GDEF, GPOS, and GSUB tables from TTFs
|
otf_file="$1"/$2.otf
|
||||||
sfntedit -x GDEF=$rom/.tb_GDEF,GPOS=$rom/.tb_GPOS,GSUB=$rom/.tb_GSUB $rom/$ro_name.ttf 1> /dev/null
|
ttf_file="$1"/$2.ttf
|
||||||
sfntedit -a GDEF=$rom/.tb_GDEF,GPOS=$rom/.tb_GPOS,GSUB=$rom/.tb_GSUB $rom/$ro_name.otf 1> /dev/null
|
dsp_file="$1"/$2.designspace
|
||||||
sfntedit -x GDEF=$itm/.tb_GDEF,GPOS=$itm/.tb_GPOS,GSUB=$itm/.tb_GSUB $itm/$it_name.ttf 1> /dev/null
|
|
||||||
sfntedit -a GDEF=$itm/.tb_GDEF,GPOS=$itm/.tb_GPOS,GSUB=$itm/.tb_GSUB $itm/$it_name.otf 1> /dev/null
|
|
||||||
|
|
||||||
# delete build artifacts
|
# build variable OTF
|
||||||
rm */Masters/.tb_*
|
buildmasterotfs --mkot -ci,"$UVS" "$dsp_file"
|
||||||
rm */Masters/master_*/*.*tf
|
buildcff2vf --omit-mac-names -d "$dsp_file"
|
||||||
|
|
||||||
echo "Done"
|
# extract and subroutinize the CFF2 table
|
||||||
|
echo 'Subroutinizing' $2.otf
|
||||||
|
tx -cff2 +S +b -std "$otf_file" "$1"/.tb_cff2 2> /dev/null
|
||||||
|
|
||||||
|
# replace CFF2 table with subroutinized version
|
||||||
|
sfntedit -a CFF2="$1"/.tb_cff2 "$otf_file"
|
||||||
|
|
||||||
|
# add SVG table to variable OTF
|
||||||
|
"$addSVG" "$otf_file" "$DIR"/svg
|
||||||
|
|
||||||
|
# build variable TTF
|
||||||
|
fontmake -m "$dsp_file" -o variable --production-names --output-path "$ttf_file" --feature-writer None
|
||||||
|
|
||||||
|
# use DSIG, name, OS/2, hhea, post, SVG, and STAT tables from OTFs
|
||||||
|
sfntedit -x DSIG="$1"/.tb_DSIG,name="$1"/.tb_name,OS/2="$1"/.tb_os2,hhea="$1"/.tb_hhea,post="$1"/.tb_post,SVG="$1"/.tb_SVG,STAT="$1"/.tb_STAT "$otf_file"
|
||||||
|
sfntedit -a DSIG="$1"/.tb_DSIG,name="$1"/.tb_name,OS/2="$1"/.tb_os2,hhea="$1"/.tb_hhea,post="$1"/.tb_post,SVG="$1"/.tb_SVG,STAT="$1"/.tb_STAT "$ttf_file"
|
||||||
|
|
||||||
|
# use cmap, GDEF, GPOS, and GSUB tables from TTFs
|
||||||
|
sfntedit -x cmap="$1"/.tb_cmap,GDEF="$1"/.tb_GDEF,GPOS="$1"/.tb_GPOS,GSUB="$1"/.tb_GSUB "$ttf_file"
|
||||||
|
sfntedit -a cmap="$1"/.tb_cmap,GDEF="$1"/.tb_GDEF,GPOS="$1"/.tb_GPOS,GSUB="$1"/.tb_GSUB "$otf_file"
|
||||||
|
|
||||||
|
# move font files to target directory
|
||||||
|
mv "$otf_file" "$var_dir"
|
||||||
|
mv "$ttf_file" "$var_dir"
|
||||||
|
|
||||||
|
# delete build artifacts
|
||||||
|
rm "$1"/.tb_*
|
||||||
|
rm "$1"/master_*/*.*tf
|
||||||
|
|
||||||
|
echo "Done with $2"
|
||||||
|
echo ""
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
build_var_font "$DIR"/Roman/Masters $ro_name
|
||||||
|
build_var_font "$DIR"/Italic/Masters $it_name
|
||||||
|
|
Loading…
Reference in New Issue