2018-11-08 10:29:12 +03:00
|
|
|
### WIP macOS build script for Work Sans Upright and Italic VF, based on a build script by Mike LaGuttuta
|
2018-11-09 14:27:09 +03:00
|
|
|
# To add brace trick glyphs, define them in $BraceGlyphs variable, and save the source VF in the same folder as the script
|
2018-11-08 10:29:12 +03:00
|
|
|
|
|
|
|
# Setting the Source and VF name, determine if it's for Italic or Upright source from the argument passed to this script
|
2018-11-09 14:27:09 +03:00
|
|
|
|
|
|
|
glyphsSource="WorkSans-build.glyphs"
|
|
|
|
VFname="WorkSans-VF"
|
|
|
|
GXname="WorkSansGX"
|
|
|
|
|
|
|
|
if [ "$1" == "Upright" ]; then
|
|
|
|
# Setting which brace glyphs will get copied from the VF generated from glyphs app
|
|
|
|
BraceGlyphs="a,ae,e,s"
|
|
|
|
elif [ "$1" == "Italic" ]; then
|
|
|
|
BraceGlyphs="ae,e,s"
|
2018-11-08 10:29:12 +03:00
|
|
|
# Italic
|
2018-11-09 14:27:09 +03:00
|
|
|
glyphsSource=${glyphsSource/"-build.glyphs"/"-Italic-build.glyphs"}
|
|
|
|
VFname=${VFname/"-VF"/"-Italic-VF"}
|
|
|
|
GXname=${GXname/"GX"/"ItalicGX"}
|
2018-11-08 10:29:12 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Call fontmake to generate variable font
|
2018-11-07 11:05:48 +03:00
|
|
|
fontmake -o variable -g $glyphsSource
|
2018-11-07 13:01:01 +03:00
|
|
|
echo "${VFname}.ttf generated"
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-09 14:27:09 +03:00
|
|
|
# Clean up files
|
2018-11-07 13:01:01 +03:00
|
|
|
mv variable_ttf/${VFname}.ttf ${VFname}.ttf
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-07 13:01:01 +03:00
|
|
|
rm -rf master_ufo
|
|
|
|
rm -rf instance_ufo
|
|
|
|
rm -rf variable_ttf
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-09 14:27:09 +03:00
|
|
|
ttx ${VFname}.ttf
|
|
|
|
rm ${VFname}.ttf
|
|
|
|
ttx ${GXname}.ttf
|
|
|
|
mv ${GXname}.ttx tools/${GXname}.ttx
|
|
|
|
|
|
|
|
# Copy brace glyphs from variable font generated from Glyphs App
|
|
|
|
# Run script to find and copy TTGlyph and glyphVariations elements from source file and copy into target file
|
|
|
|
xml tr tools/replaceBraceGlyphs.xsl \
|
|
|
|
-s replacements=${GXname}.ttx \
|
|
|
|
-s replacenames=$BraceGlyphs \
|
|
|
|
${VFname}.ttx > ${VFname}-brace.ttx
|
|
|
|
echo "Brace glyphs added"
|
|
|
|
|
|
|
|
# Clean up files
|
|
|
|
rm tools/${GXname}.ttx
|
|
|
|
rm ${VFname}.ttx
|
|
|
|
ttx ${VFname}-brace.ttx
|
|
|
|
rm ${VFname}-brace.ttx
|
|
|
|
mv ${VFname}-brace.ttf ${VFname}.ttf
|
|
|
|
|
|
|
|
# Add featureVariation for bracket trick glyphs
|
|
|
|
python tools/replaceBracketTrick.py ${VFname}.ttf "$1"
|
|
|
|
mv ${VFname}-swap.ttf ${VFname}.ttf
|
|
|
|
echo "Bracket glyphs added"
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-08 10:29:12 +03:00
|
|
|
# Fix non-hinting, DSIG and GASP table
|
2018-11-07 13:01:01 +03:00
|
|
|
gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf
|
|
|
|
gftools fix-gasp ${VFname}.ttf
|
2018-11-09 14:27:09 +03:00
|
|
|
echo "nonhinting, gasp fixed"
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-09 14:27:09 +03:00
|
|
|
# Clean up files
|
|
|
|
rm ${VFname}-backup-fonttools-prep-gasp.ttf
|
|
|
|
# rm ${GXname}.ttf
|
2018-11-07 10:27:25 +03:00
|
|
|
|
2018-11-08 13:36:47 +03:00
|
|
|
# # Fix VF Metadata
|
|
|
|
# python tools/gftools-fix-vf-meta.py ${VFname}.ttf
|
|
|
|
# echo "vf-meta fixed"
|
|
|
|
# # Clean up and rename VF
|
|
|
|
# rm ${VFname}.ttf
|
|
|
|
# mv ${VFname}.ttf.fix ${VFname}.ttf
|
2018-11-07 13:01:01 +03:00
|
|
|
|
2018-11-09 14:27:09 +03:00
|
|
|
# # Correct nameID 6 (remove space)
|
|
|
|
# python tools/NAMEpatch.py ${VFname}.ttf
|
|
|
|
# rm ${VFname}.ttf
|
|
|
|
# mv ${VFname}#1.ttf ${VFname}.ttf
|
|
|
|
# echo "nameID 6 fixed"
|
2018-11-08 10:29:12 +03:00
|
|
|
|
2018-11-08 13:36:47 +03:00
|
|
|
# Fix DSIG
|
|
|
|
gftools fix-dsig --autofix ${VFname}.ttf
|
|
|
|
|
2018-11-09 14:27:09 +03:00
|
|
|
# if [ "$1" = "Italic" ]; then
|
|
|
|
# # Rename *-ItalicItalic to -Italic
|
|
|
|
# for i in *.ttf; do
|
|
|
|
# mv "$i" "${i//ItalicItalic/Italic}"
|
|
|
|
# done
|
|
|
|
# fi
|
2018-11-08 10:29:12 +03:00
|
|
|
|
|
|
|
# fontbakery check-googlefonts ${VFname}.ttf --ghmarkdown fontbakery-report.md
|
2018-11-07 13:01:01 +03:00
|
|
|
|
|
|
|
## move font into folder of dist/, with timestamp, then fontbake the font
|
2018-11-07 11:05:48 +03:00
|
|
|
# python3 tools/distdate-and-fontbake.py ${VFname}.ttf
|