From 6cc067911f6f4855d399bc3c662668342d4fe64e Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Wed, 26 Jul 2017 00:25:55 -0700 Subject: [PATCH] Update build scripts --- build.cmd | 8 +++----- build.sh | 14 +++++++------- buildVFs.sh | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/build.cmd b/build.cmd index fdc0e4b26c..8c70815d37 100644 --- a/build.cmd +++ b/build.cmd @@ -43,10 +43,8 @@ goto :eof :: %1 - Roman/Italic :: %2 - Weight :build_font -call makeotf -f "%~dp0\%1\%2\font.ufo" -r -o "%TARGET_OTF_PATH%\%FAMILY%-%2.otf" -call makeotf -f "%~dp0\%1\%2\font.ttf" -r -o "%TARGET_TTF_PATH%\%FAMILY%-%2.ttf" -:: remove default options file from the source tree after building -del "%~dp0\%1\%2\current.fpr" +call makeotf -f "%~dp0\%1\Instances\%2\font.ufo" -r -ci "%~dp0\uvs.txt" -o "%TARGET_OTF_PATH%\%FAMILY%-%2.otf" +call makeotf -f "%~dp0\%1\Instances\%2\font.ttf" -r -ci "%~dp0\uvs.txt" -o "%TARGET_TTF_PATH%\%FAMILY%-%2.ttf" -ff "%~dp0\%1\Instances\%2\font.ufo\features.fea" "%PYTHON_PATH%" "%~dp0\addSVGtable.py" "%TARGET_OTF_PATH%\%FAMILY%-%2.otf" "%~dp0\svg" "%PYTHON_PATH%" "%~dp0\addSVGtable.py" "%TARGET_TTF_PATH%\%FAMILY%-%2.ttf" "%~dp0\svg" goto :eof @@ -59,7 +57,7 @@ exit /b 1 :: :: Get directory name from full path name. :: Usage: -:: GetDirectoryName VARIABLE VALUE +:: GetDirectoryName VARIABLE VALUE :: :GetDirectoryName call set %~1=%~dp2 diff --git a/build.sh b/build.sh index 3a701bd2fe..6181c658d1 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh family=SourceCodePro romanWeights='Black Bold ExtraLight Light Medium Regular Semibold' @@ -18,18 +18,18 @@ mkdir -p $otfDir $ttfDir for w in $romanWeights do - makeotf -f Roman/$w/font.ufo -r -ci "$UVS" -o $otfDir/$family-$w.otf - makeotf -f Roman/$w/font.ttf -r -ci "$UVS" -o $ttfDir/$family-$w.ttf - rm Roman/$w/current.fpr # remove default options file from the source tree after building + font_path=Roman/Instances/$w/font + 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 for w in $italicWeights do - makeotf -f Italic/$w/font.ufo -r -ci "$UVS" -o $otfDir/$family-$w.otf - makeotf -f Italic/$w/font.ttf -r -ci "$UVS" -o $ttfDir/$family-$w.ttf - rm Italic/$w/current.fpr # remove default options file from the source tree after building + font_path=Italic/Instances/$w/font + 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 diff --git a/buildVFs.sh b/buildVFs.sh index 7678d37b2a..591375536e 100644 --- a/buildVFs.sh +++ b/buildVFs.sh @@ -1,8 +1,32 @@ -buildMasterOTFs RomanMasters/SourceCodePro.designspace -buildCFF2VF RomanMasters/SourceCodePro.designspace RomanMasters/SourceCodePro-Variable.otf +#!/usr/bin/env sh -buildMasterOTFs ItalicMasters/SourceCodePro-Italic.designspace -buildCFF2VF ItalicMasters/SourceCodePro-Italic.designspace ItalicMasters/SourceCodePro-VariableItalic.otf +# path to Python script that adds the SVG table +addSVG=$(cd $(dirname "$0") && pwd -P)/addSVGtable.py -rm *Masters/master_*/current.fpr -rm *Masters/master_*/master.otf +rom=Roman/Masters +itm=Italic/Masters + +ro_name=SourceCodeVariable-Roman +it_name=SourceCodeVariable-Italic + +# build variable OTFs +buildMasterOTFs $rom/$ro_name.designspace +buildCFF2VF $rom/$ro_name.designspace +buildMasterOTFs $itm/$it_name.designspace +buildCFF2VF $itm/$it_name.designspace + +# extract and subroutinize the CFF2 table +tx -cff2 +S +b -std $rom/$ro_name.otf $rom/.tb_cff2 +tx -cff2 +S +b -std $itm/$it_name.otf $itm/.tb_cff2 + +# replace CFF2 table with subroutinized version +sfntedit -a CFF2=$rom/.tb_cff2 $rom/$ro_name.otf +sfntedit -a CFF2=$itm/.tb_cff2 $itm/$it_name.otf + +# add SVG table to variable OTFs +"$addSVG" $rom/$ro_name.otf svg +"$addSVG" $itm/$it_name.otf svg + +# delete build artifacts +rm */Masters/.tb_* +rm */Masters/master_*/*.*tf