Here is my code:
$CurrentFile = $_
$DestPath = "FontForge Export"
if(!(Test-Path -LiteralPath $DestPath -PathType Container)){
New-Item -Path $DestPath -ItemType Directory -Force | Out-Null
}
fontforge -lang=ff -c 'Open($1); SelectAll(); UnlinkReference(); Export("FontForge Export/%n-%e.svg");' $CurrentFile
No matter what I do, I cannot get the fontforge
call to accept a powershell variable in the Export("FontForge Export/%n-%e.svg");
block. The above code works because I've defined a hard-coded directory name ("FontForge Export"). But as soon as I try something like this:
$CurrentFile = $_
$FullNoExt = [IO.Path]::GetFileNameWithoutExtension($CurrentFile)
$DestFolder = "$FullNoExt FontForge Export"
if(!(Test-Path -LiteralPath $DestFolder -PathType Container)){
New-Item -Path $DestFolder -ItemType Directory -Force | Out-Null
}
fontforge -lang=ff -c "Open(`$1); SelectAll(); UnlinkReference(); Export("$DestFolder/%n-%e.svg");" $CurrentFile
I get en error:
Couldn't find a font file named C:/Users/[username]/Desktop/Test/Adobe CC Acumin Pro/Acumin Pro Black FontForge Export/%n-%e.svg);
The requested file, %n-%e.svg);, does not exist
Open: Failed to open: Acumin Pro Black FontForge Export/%n-%e.svg);
Called from...
<command-string>: line 1
I need a dynamic output folder from FontForge so I can run the script in parallel over several typefaces.
No matter what I do I just can't finesse the correct syntax.
Can someone help?
I really need some fresh eyes.
Adding some more information:
Tried using the format operator with no success either.
$cmdd = "$DestFolder/%n-%e.svg"
fontforge -lang=ff -c 'Open($1); SelectAll(); UnlinkReference(); Export({0});' $CurrentFile -f $cmdd