-
Notifications
You must be signed in to change notification settings - Fork 9
/
adobe-fonts-liberator.ps1
49 lines (33 loc) · 1.6 KB
/
adobe-fonts-liberator.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#################################################################################
#
# https://github.com/pawalan/adobe-fonts-liberator
# kudos to Steven Kalinke <https://github.com/kalaschnik/adobe-fonts-revealer>
#
################################################################################
# Configuration - usually no need to change something, but suit yourself
$AdobeFontsDir = "$env:APPDATA\Adobe\CoreSync\plugins\livetype\r"
$DesktopDir = [Environment]::GetFolderPath("Desktop")
$DestinationDir = Join-Path -Path $DesktopDir -ChildPath 'Adobe Fonts'
######################### script code - don't change unless you know what you do! ###############################################
Clear-Host
Write-Output "`n`rLiberating Adobe Fonts`n`r`n`rfrom`t$AdobeFontsDir`n`rto`t`t$DestinationDir`n`r`n`r"
if ( Test-Path -Path "$DestinationDir\*" ) {
Write-Error "Destination directory is not empty, aborting."
exit 1
} else {
New-Item -Path $DestinationDir -ItemType Directory -Force | Out-Null
}
Get-ChildItem -Path $AdobeFontsDir | ForEach-Object {
$binary = Join-Path -Path $PSScriptRoot -ChildPath 'otfinfo.exe'
$args = ' --postscript-name ' + $_.FullName
$command = $binary + $args
$fontName = (Invoke-Expression $command).Trim()
$fontFile = Join-Path -Path $DestinationDir -ChildPath "$fontName.otf"
Copy-Item -Path $_.FullName -Destination $fontFile
if ($? -eq $true) {
Write-Output "Liberated`t$_`tto`t$fontName.otf"
} else {
Write-Error "Failed to copy`t$_`to`t$fontFile"
}
}
Write-Output "`n`r`n`rLong live the free fonts!`n`r`n`rBye!`n`r"