Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
hellofont/detect-font-name.ps1
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
14 lines (11 sloc)
511 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fontPath = "C:\Windows\Fonts\courbd.ttf" | |
try { | |
if (!(Test-Path -Path $fontPath -PathType Leaf)) { | |
throw "在路径 $fontPath 未找到字体文件" | |
} | |
$fontFamily = [System.Drawing.FontFamily]::new($fontPath) | |
Write-Host "字体文件 '$fontPath' 有效。字体族名称:$($fontFamily.Name)" | |
} catch { | |
Write-Error "加载字体文件 '$fontPath' 时出错:$($_.Exception.Message)" | |
# 可在此处添加更具体的错误处理,例如检查特定异常类型。 | |
} | |