From 9050a7926bb795e9c6413c8cb2bb63ceb223036b Mon Sep 17 00:00:00 2001 From: Miguel Sousa Date: Tue, 11 Jul 2017 06:10:04 -0700 Subject: [PATCH] Update build scripts --- build.cmd | 8 ++------ build.sh | 14 +++++++------- buildVFs.sh | 42 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/build.cmd b/build.cmd index 05d59f060a..3557441488 100644 --- a/build.cmd +++ b/build.cmd @@ -43,12 +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" -:: "%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" +call makeotf -f "%~dp0\%1\Instances\%2\font.ufo" -r -o "%TARGET_OTF_PATH%\%FAMILY%-%2.otf" +call makeotf -f "%~dp0\%1\Instances\%2\font.ttf" -r -o "%TARGET_TTF_PATH%\%FAMILY%-%2.ttf" goto :eof :error_makeotf_not_found diff --git a/build.sh b/build.sh index ab9d9e4a47..b0c7974f6b 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/env sh family=SourceSansPro romanWeights='Black Bold ExtraLight Light Regular Semibold' @@ -10,15 +10,15 @@ mkdir target/ target/OTF/ target/TTF/ for w in $romanWeights do - makeotf -f Roman/$w/font.ufo -r -o target/OTF/$family-$w.otf - makeotf -f Roman/$w/font.ttf -r -o target/TTF/$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 -o target/OTF/$family-$w.otf + makeotf -f $font_path.ttf -r -o target/TTF/$family-$w.ttf -ff $font_path.ufo/features.fea done for w in $italicWeights do - makeotf -f Italic/$w/font.ufo -r -o target/OTF/$family-$w.otf - makeotf -f Italic/$w/font.ttf -r -o target/TTF/$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 -o target/OTF/$family-$w.otf + makeotf -f $font_path.ttf -r -o target/TTF/$family-$w.ttf -ff $font_path.ufo/features.fea done diff --git a/buildVFs.sh b/buildVFs.sh index 02bcaee184..7bd7c86c58 100644 --- a/buildVFs.sh +++ b/buildVFs.sh @@ -1,8 +1,38 @@ -buildMasterOTFs RomanMasters/SourceSansPro.designspace -buildCFF2VF RomanMasters/SourceSansPro.designspace RomanMasters/SourceSansPro-Variable.otf +#!/bin/env sh -buildMasterOTFs ItalicMasters/SourceSansPro-Italic.designspace -buildCFF2VF ItalicMasters/SourceSansPro-Italic.designspace ItalicMasters/SourceSansPro-VariableItalic.otf +rom=Roman/Masters +itm=Italic/Masters -rm *Masters/master_*/current.fpr -rm *Masters/master_*/master.otf +# build variable OTFs +buildMasterOTFs $rom/SourceSansVariable-Roman.designspace +buildCFF2VF $rom/SourceSansVariable-Roman.designspace +buildMasterOTFs $itm/SourceSansVariable-Italic.designspace +buildCFF2VF $itm/SourceSansVariable-Italic.designspace + +# extract and subroutinize the CFF2 table +tx -cff2 +S +b -std $rom/SourceSansVariable-Roman.otf $rom/.tb_cff2 +tx -cff2 +S +b -std $itm/SourceSansVariable-Italic.otf $itm/.tb_cff2 + +# replace CFF2 table with subroutinized version +sfntedit -a CFF2=$rom/.tb_cff2 $rom/SourceSansVariable-Roman.otf +sfntedit -a CFF2=$itm/.tb_cff2 $itm/SourceSansVariable-Italic.otf + +# build variable TTFs +fontmake -m $rom/SourceSansVariable-Roman.designspace -o variable --production-names +fontmake -m $itm/SourceSansVariable-Italic.designspace -o variable --production-names + +# use DSIG, name, OS/2, and STAT tables from OTFs +sfntedit -x DSIG=$rom/.tb_DSIG,name=$rom/.tb_name,OS/2=$rom/.tb_os2,STAT=$rom/.tb_STAT $rom/SourceSansVariable-Roman.otf +sfntedit -a DSIG=$rom/.tb_DSIG,name=$rom/.tb_name,OS/2=$rom/.tb_os2,STAT=$rom/.tb_STAT $rom/SourceSansVariable-Roman.ttf +sfntedit -x DSIG=$itm/.tb_DSIG,name=$itm/.tb_name,OS/2=$itm/.tb_os2,STAT=$itm/.tb_STAT $itm/SourceSansVariable-Italic.otf +sfntedit -a DSIG=$itm/.tb_DSIG,name=$itm/.tb_name,OS/2=$itm/.tb_os2,STAT=$itm/.tb_STAT $itm/SourceSansVariable-Italic.ttf + +# use cmap, GDEF, GPOS, and GSUB tables from TTFs +sfntedit -x cmap=$rom/.tb_cmap,GDEF=$rom/.tb_GDEF,GPOS=$rom/.tb_GPOS,GSUB=$rom/.tb_GSUB $rom/SourceSansVariable-Roman.ttf +sfntedit -a cmap=$rom/.tb_cmap,GDEF=$rom/.tb_GDEF,GPOS=$rom/.tb_GPOS,GSUB=$rom/.tb_GSUB $rom/SourceSansVariable-Roman.otf +sfntedit -x cmap=$itm/.tb_cmap,GDEF=$itm/.tb_GDEF,GPOS=$itm/.tb_GPOS,GSUB=$itm/.tb_GSUB $itm/SourceSansVariable-Italic.ttf +sfntedit -a cmap=$itm/.tb_cmap,GDEF=$itm/.tb_GDEF,GPOS=$itm/.tb_GPOS,GSUB=$itm/.tb_GSUB $itm/SourceSansVariable-Italic.otf + +# delete build artifacts +rm */Masters/master_*/master.*tf +rm */Masters/.tb_*