35ecc2c169e2ffdcc3928a96960a417bfa163c64
[webi-installers/.git] / nerdfont / install.ps1
1 #!/bin/pwsh
2
3 $my_nerdfont_otf = "Droid Sans Mono for Powerline Nerd Font Complete Windows Compatible.otf"
4 $my_fontdir = "$Env:UserProfile\AppData\Local\Microsoft\Windows\Fonts"
5
6 New-Item -Path "$my_fontdir" -ItemType Directory -Force
7 IF (!(Test-Path -Path "$my_fontdir\$my_nerdfont_otf"))
8 {
9
10     & curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf'
11     & move "$my_nerdfont_otf" "$my_fontdir"
12 }
13
14
15 # See https://superuser.com/a/1306464/73857
16 pushd "$my_fontdir"
17 Add-Type -Name Session -Namespace "" -Member @"
18 [DllImport("gdi32.dll")]
19 public static extern int AddFontResource(string filePath);
20 "@
21
22 $null = foreach($font in Get-ChildItem -Recurse -Include *.ttf, *.otf) {
23     [Session]::AddFontResource($font.FullName)
24 }
25
26 echo "Installed $my_nerdfont_otf to $my_fontdir"