Published in Articles on by Michiel van Oosterhout ~ 4 min read

Windows 11 includes many font families, including the new Cascadia Mono and Cascadia Code font families. These new font families are designed for command-line programs and text editors, and included in Windows 11 via the Windows Terminal app. Microsoft provides an additional version of each Cascadia font family, with embedded Powerline symbols. This article will show how to automate the installation of the Cascadia Mono PL font.

Cascade Pass
Cascade Pass US National Parks Service, CC BY-NC

Download and install Cascadia Mono PL

The Cascadia fonts are open source, released under the SIL Open Font License, and can be downloaded from the GitHub project's releases page.

The Windows PowerShell script below downloads the current release and installs only the Cascadia Mono PL font.

(This script requires an elevated Windows PowerShell session.)

(After installation a restart may be necessary before the font can be selected in any application.)

# Download the archive file
$downloadsPath = "$Env:USERPROFILE\Downloads"
$zipFileName = "CascadiaCode-2111.01.zip"
$zipFilePath = "$downloadsPath\$zipFileName"
$url = "https://github.com/microsoft/cascadia-code/releases/download/v2111.01/$zipFileName"
Invoke-WebRequest -Uri $url -OutFile $zipFilePath

# Expand, then delete, the archive file
$expandedDirectoryPath = "$downloadsPath\CascadiaCode-2111.01"
Expand-Archive -Path $zipFilePath -Destination $expandedDirectoryPath
Remove-Item -Force -Path $zipFilePath

# Use the Shell's automation to obtain the path to the fonts directory
$fontsPath = (New-Object -ComObject "Shell.Application").Namespace(0x14).Self.Path

# Copy font file
$fontFileName = "CascadiaMonoPL.ttf"
$fontFilePath = "$expandedDirectoryPath\ttf\$fontFileName"
Write-Host "Installing font [Cascadia Mono PL]..." -NoNewline
Copy-Item -Path $fontFilePath -Destination $fontsPath -Force
Write-Host " OK"

# Ensuring the registry key exists
$fontsKey = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts"
if (-not (Test-Path -Path $fontsKey))
{
    $key = New-Item -Force -ItemType Directory -Path $fontsKey
}

# Add the registry key for the font file
Write-Host "Registering font [Cascadia Mono PL]..." -NoNewline
$value = New-ItemProperty -Force -Name "Cascadia Mono PL Regular (TrueType)" -Path $fontsKey -PropertyType $type -Value "$fontsPath\$fontFileName"
Write-Host " OK"

# Delete downloaded files
Remove-Item -Force -Path $expandedDirectoryPath -Recurse

Normally a font is installed to $Env:SystemRoot\Fonts by opening the font file and clicking Install for all users, or to $Env:LOCALAPPDATA\Microsoft\Windows\Fonts by right-clicking the font file and selecting Install. A corresponding registry value referencing the font file is added to the HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Fonts or HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Fonts registry key respectively.

Testing Powerline symbols

To test the font start Windows PowerShell, change the font to Cascadia Mono PL, and then enter a string value that contains the Unicode code point for the left divider symbol: "$([char]0xE0B0)". Alternatively enter Unicode code point directly: [char]0xE0B0, or use the Unicode escape sequence added in PowerShell 6: "`u{E0B0}". The Windows Console Host should render the Powerline symbol.

Windows Console Host rendering a Powerline symbol
Windows Console Host rendering a Powerline symbol

Summary

Microsoft has created the Cascadia Mono open-source font family and it is included in Windows 11 by way of Windows Terminal. Microsoft has also released a version of Cascadia Mono with embedded Powerline symbols, but this needs to be installed separately by copying the file and referencing it in the Windows Registry. Powerline symbols are rendered by the Windows Console Host when a command-line program, such as Windows PowerShell, outputs the corresponding character.