2021-01-13 15:20:59 +00:00
|
|
|
[CmdletBinding()]
|
|
|
|
param (
|
|
|
|
[Parameter()]
|
|
|
|
[string]
|
|
|
|
$FontPath
|
|
|
|
)
|
|
|
|
|
|
|
|
Add-Type -AssemblyName PresentationCore
|
|
|
|
|
|
|
|
$face = New-Object System.Windows.Media.GlyphTypeface -ArgumentList "$(Resolve-Path $FontPath)"
|
|
|
|
$style = "$($face.Style)"
|
|
|
|
$weight = "$($face.Weight)"
|
|
|
|
$stretch = "$($face.Stretch)"
|
|
|
|
|
|
|
|
$name = $face.FamilyNames["en-US"] -replace '\W',''
|
|
|
|
if ($style -ne "Normal") {
|
|
|
|
$name += "-$($style)"
|
|
|
|
}
|
|
|
|
if ($weight -ne "Normal") {
|
|
|
|
$name += "-$($weight)"
|
|
|
|
}
|
|
|
|
if ($stretch -ne "Normal") {
|
|
|
|
$name += "-$(stretch)"
|
|
|
|
}
|
2020-11-17 08:26:46 +00:00
|
|
|
$name
|