Making build.sh script

This commit is contained in:
weiweihuanghuang 2018-11-07 19:05:48 +11:00
parent ab8579a4ef
commit dbcc69d6b6
6 changed files with 99 additions and 60 deletions

View File

@ -49,11 +49,17 @@ Mathieu Cannavo, Vincent Chan, Greg Gazdowicz, Jack Jennings, Seb McLauchlan, Da
Thanks to the following people for their assitance and contributions: Thanks to the following people for their assitance and contributions:
[CrystalType](https://github.com/crystaltype), [CrystalType](https://github.com/crystaltype)
[Dennis Grauel](https://dennisgrauel.com/),
[Denis Moyogo Jacquerye](https://github.com/moyogo), [Dennis Grauel](https://dennisgrauel.com/)
[Desmond Wong](http://desmondwong.com/),
[Kia Tasbihgou](http://www.kiatas.me/), [Denis Moyogo Jacquerye](https://github.com/moyogo)
[Stephen Nixon](http://www.thundernixon.com/)
[Desmond Wong](http://desmondwong.com/)
[Kia Tasbihgou](http://www.kiatas.me/)
Thanks to Simon Egli for inviting me to work together on Metapolator in the first place. Thanks to Simon Egli for inviting me to work together on Metapolator in the first place.

View File

@ -1,37 +1,22 @@
cp WorkSans-Upright.glyphs WorkSans-UprightBuild.glyphs ### WIP macOS build script for Work Sans VF, based on a build script by Mike LaGuttuta
fontmake -o variable -g WorkSans-UprightBuild.glyphs glyphsSource="WorkSans.glyphs"
VFname="WorkSans-VF"
mv variable_ttf/WorkSans-VF.ttf WorkSans-VF.ttf fontmake -o variable -g $glyphsSource
rm -rf WorkSans-UprightBuild.glyphs # mv variable_ttf/${VFname}.ttf ${VFname}.ttf
rm -rf master_ufo
rm -rf variable_ttf
python ./addItalics.py WorkSans-VF.ttf # rm -rf master_ufo
# rm -rf variable_ttf
gftools fix-nonhinting WorkSans-VF.ttf WorkSans-VF.ttf # python tools/swapBracketTrick.py ${VFname}.ttf "Upright"
gftools fix-dsig --autofix WorkSans-VF.ttf
gftools fix-gasp WorkSans-VF.ttf
ttfautohint WorkSans-VF.ttf WorkSans-VF-Hinted.ttf --verbose
python ./gftools-fix-vf-meta.py WorkSans-VF-Hinted.ttf # gftools fix-nonhinting ${VFname}.ttf ${VFname}.ttf
# gftools fix-dsig --autofix ${VFname}.ttf
# gftools fix-gasp ${VFname}.ttf
## move font into folder of dist/, with timestamp, then fontbake the font # python tools/gftools-fix-vf-meta.py ${VFname}.ttf
python3 ./distdate-and-fontbake.py WorkSans-VF-Hinted.ttf
rm -rf variable_ttf
# ttx WorkSans-VF.ttf # ## move font into folder of dist/, with timestamp, then fontbake the font
# python3 tools/distdate-and-fontbake.py ${VFname}.ttf
# rm -rf WorkSans-VF.ttf
# rm -rf WorkSans-Upright-VF-backup-fonttools-prep-gasp.ttf
# cat WorkSans-Upright-VF.ttx | tr '\n' '\r' | sed -e "s,<STAT>.*<\/STAT>,$(cat tools/patch1.xml | tr '\n' '\r')," | tr '\r' '\n' > WorkSans-Upright-VF-STAT.ttx
# rm -rf WorkSans-Upright-VF.ttx
# ttx WorkSans-Upright-VF-STAT.ttx
# rm -rf WorkSans-Upright-VF-STAT.ttx
# mv WorkSans-Upright-VF-STAT.ttf WorkSans-UprightBeta-VF.ttf

View File

@ -1,26 +0,0 @@
import os
import sys
import fontTools
from fontTools.ttLib import TTFont
from fontTools.varLib.featureVars import addFeatureVariations
from fontTools.ttx import makeOutputFileName
inputTTF = sys.argv[1]
# f = TTFont(fontPath)
f = TTFont(inputTTF)
condSubst = [
# A list of (Region, Substitution) tuples.
([{"wght": (0.158, 0.564)}], {"a": "a.swsh"}),
([{"wght": (0.868, 1.0)}], {"dollar": "dollar.201_230"}),
]
addFeatureVariations(f, condSubst)
# newFontPath = fontPath.split(".")[0] + "-italic.ttf"
# f.save(fontPath)
extension = os.path.splitext(inputTTF)[1]
outputTTF = makeOutputFileName(inputTTF, '', extension)
f.save(outputTTF)

View File

@ -0,0 +1,28 @@
import sys
import os
import shutil
from datetime import datetime
arg = sys.argv[-1]
fontFile = arg.split("/")[1]
fontName = fontFile.split(".")[0]
# make timestamped folder in dist, like `SampleFont_2015-10-21-017_03`
currentDatetime = datetime.now().strftime('%Y-%m-%d-%H_%M')
# outputFolder = 'dist/' + GLYPHS_PATH.replace('sources/', '').replace('.glyphs', '-VF-') + currentDatetime + '/'
outputFolder = f'dist/{fontName}-{currentDatetime}'
if not os.path.exists(outputFolder):
os.makedirs(outputFolder)
defaultFontPath = arg
newFontPath = f'{outputFolder}/{fontFile}'
shutil.move(defaultFontPath, newFontPath)
# run fontbakery check on new font
fontbakeryCommand = f'fontbakery check-googlefonts {newFontPath} --ghmarkdown {outputFolder}/fontbakery-report.md'
print("fontbakeryCommand is " + fontbakeryCommand)
print(os.system(fontbakeryCommand))

View File

@ -0,0 +1,46 @@
### Based on a script by Stephen Nixon
import os
import sys
import fontTools
from fontTools.ttLib import TTFont
from fontTools.varLib.featureVars import addFeatureVariations
from fontTools.ttx import makeOutputFileName
inputTTF = sys.argv[1]
style = sys.argv[2]
# f = TTFont(fontPath)
f = TTFont(inputTTF)
condSubst = [
# A list of (Region, Substitution) tuples.
([{"wght": (0.158, 0.564)}], {"apple", "apple.001"}),
([{"wght": (0.868, 1)}], {"cedi", "cedi.201_230"}),
([{"wght": (0.868, 1)}], {"cent", "cent.201_230"}),
([{"wght": (0.868, 1)}], {"colonsign", "colonsign.201_230"}),
([{"wght": (0.868, 1)}], {"dollar", "dollar.201_230"}),
([{"wght": (0.868, 1)}], {"guarani", "guarani.201_230"}),
([{"wght": (0.868, 1)}], {"dollar.tf", "dollar.tf.201_230"}),
([{"wght": (0.868, 1)}], {"cent.tf", "cent.tf.201_230"}),
([{"wght": (0.71, 1)}], {"naira", "naira.169_230"}),
([{"wght": (0.71, 1)}], {"peseta", "peseta.169_230"}),
([{"wght": (0.71, 1)}], {"won", "won.169_230"}),
([{"wght": (0.564, 1)}], {"peso", "peso.136_230"}),
([{"wght": (0.424, 1)}], {"curvedStemParagraphSignOrnament", "curvedStemParagraphSignOrnament.79_230"}),
([{"wght": (0.424, 1)}], {"paragraph", "paragraph.79_230"})
]
if style == "Upright":
condSubst += [
([{"wght": (0.564, 1)}], {"Adieresis.titl", "Adieresis.titl.136_230"}),
([{"wght": (0.564, 1)}], {"Odieresis.titl", "Odieresis.titl.136_230"}),
]
addFeatureVariations(f, condSubst)
# newFontPath = fontPath.split(".")[0] + "-italic.ttf"
# f.save(fontPath)
extension = os.path.splitext(inputTTF)[1]
outputTTF = makeOutputFileName(inputTTF, '', extension)
f.save(outputTTF)