From d3940070ed76ba4810a6f41e650e434cd735ac97 Mon Sep 17 00:00:00 2001 From: kiliman Date: Mon, 9 Mar 2020 17:06:18 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20multiple=20font=20generati?= =?UTF-8?q?on=20using=20profiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.bat | 2 +- build.sh | 5 ++++- index.js | 8 +++----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build.bat b/build.bat index e9dc429..320343f 100644 --- a/build.bat +++ b/build.bat @@ -24,5 +24,5 @@ if not exist .\ligature\%lig%\glyphs\* exit /b @echo Building %lig% ttx -f .\original\%otf%.otf node index.js %otf% -ttx -f .\build\%lig%.ttx +for %%f in (.\build\%lig%*.ttx) do ttx -f %%f exit /b diff --git a/build.sh b/build.sh index c4fe7a5..a27374d 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,10 @@ build_font() { echo Building $1 ttx -f "./original/$otf.otf" node index.js $otf - ttx -f ./build/$1.ttx + + for f in ./build/$1*.ttx ; do + ttx -f $f + done } if [ -n "$1" ] diff --git a/index.js b/index.js index b95dba6..a3f0edb 100644 --- a/index.js +++ b/index.js @@ -36,9 +36,7 @@ function main() { const buildFont = profile => { // add suffix to dstFileName if present - const dstFileName = `./build/${ligFontName}${ - profile.suffixWithLeadingHyphen - }.ttx`; + const dstFileName = `./build/${ligFontName}${profile.suffixWithLeadingHyphen}.ttx`; console.log( `Building ligature font file ${dstFileName} name = ${profile.name}` ); @@ -87,7 +85,7 @@ const getProfiles = () => { const content = fs.readFileSync(profilePath, 'utf-8'); content - .split(os.EOL) + .split(/\r|\r\n|\n/g) .filter(line => /^[#]/.test(line) === false && line.length > 0) .forEach(line => { const ch = line.trim()[0]; @@ -103,7 +101,7 @@ const getProfiles = () => { profiles.push(profile); } else { if (!profile) { - throw new Error('You must profile a profile name in []'); + throw new Error('You must provide a profile name in []'); } profile.ligatures.push(line); }