From dbcc69d6b6e60649b87953564c853dae853db90d Mon Sep 17 00:00:00 2001 From: weiweihuanghuang Date: Wed, 7 Nov 2018 19:05:48 +1100 Subject: [PATCH] Making build.sh script --- README.md | 16 ++++-- sources/build.sh | 43 ++++++---------- .../Bracket Trick Glyph Swapping.ods} | Bin 25358 -> 25350 bytes sources/tools/addItalics.py | 26 ---------- sources/tools/distdate-and-fontbake.py | 28 +++++++++++ sources/tools/swapBracketTrick.py | 46 ++++++++++++++++++ 6 files changed, 99 insertions(+), 60 deletions(-) rename sources/{Glyph Swapping.ods => tools/Bracket Trick Glyph Swapping.ods} (78%) delete mode 100755 sources/tools/addItalics.py create mode 100755 sources/tools/distdate-and-fontbake.py create mode 100755 sources/tools/swapBracketTrick.py diff --git a/README.md b/README.md index a4d9691..d8bdcae 100755 --- a/README.md +++ b/README.md @@ -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: -[CrystalType](https://github.com/crystaltype), -[Dennis Grauel](https://dennisgrauel.com/), -[Denis Moyogo Jacquerye](https://github.com/moyogo), -[Desmond Wong](http://desmondwong.com/), -[Kia Tasbihgou](http://www.kiatas.me/), +[CrystalType](https://github.com/crystaltype) + +[Dennis Grauel](https://dennisgrauel.com/) + +[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. diff --git a/sources/build.sh b/sources/build.sh index f79000f..fd64aea 100755 --- a/sources/build.sh +++ b/sources/build.sh @@ -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 -rm -rf master_ufo -rm -rf variable_ttf +# mv variable_ttf/${VFname}.ttf ${VFname}.ttf -python ./addItalics.py WorkSans-VF.ttf +# rm -rf master_ufo +# rm -rf variable_ttf -gftools fix-nonhinting WorkSans-VF.ttf WorkSans-VF.ttf -gftools fix-dsig --autofix WorkSans-VF.ttf -gftools fix-gasp WorkSans-VF.ttf -ttfautohint WorkSans-VF.ttf WorkSans-VF-Hinted.ttf --verbose +# python tools/swapBracketTrick.py ${VFname}.ttf "Upright" -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 - python3 ./distdate-and-fontbake.py WorkSans-VF-Hinted.ttf - rm -rf variable_ttf +# python tools/gftools-fix-vf-meta.py ${VFname}.ttf -# ttx WorkSans-VF.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>,$(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 \ No newline at end of file +# ## move font into folder of dist/, with timestamp, then fontbake the font +# python3 tools/distdate-and-fontbake.py ${VFname}.ttf \ No newline at end of file diff --git a/sources/Glyph Swapping.ods b/sources/tools/Bracket Trick Glyph Swapping.ods similarity index 78% rename from sources/Glyph Swapping.ods rename to sources/tools/Bracket Trick Glyph Swapping.ods index f3728ad5d9674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>|4P63=z%z(AiFW!)Zj$Z=fZvpPi1wQyC*uv?~gUMJxf8MU7 zVltRMzzF98t~yhb+O;@wk$LC?6Z$;=pXq<5-`59<^#y=uPS8IkJ)6os)cNnKKNGn;S!fXfgFw0v5Qr7%aiInC0OKyA&^wN#2LA)7YK0mA diff --git a/sources/tools/addItalics.py b/sources/tools/addItalics.py deleted file mode 100755 index a05e49d..0000000 --- a/sources/tools/addItalics.py +++ /dev/null @@ -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) \ No newline at end of file diff --git a/sources/tools/distdate-and-fontbake.py b/sources/tools/distdate-and-fontbake.py new file mode 100755 index 0000000..a58dba4 --- /dev/null +++ b/sources/tools/distdate-and-fontbake.py @@ -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)) \ No newline at end of file diff --git a/sources/tools/swapBracketTrick.py b/sources/tools/swapBracketTrick.py new file mode 100755 index 0000000..b50205b --- /dev/null +++ b/sources/tools/swapBracketTrick.py @@ -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) \ No newline at end of file