Backup: seewo-kit MCP tools and courseware anim scripts
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
param([string]$InFile, [string]$OutFile, [double]$Size = 28, [string]$Font = "Microsoft YaHei")
|
||||
# 用 WPF 的 FormattedText 量文字宽度(希沃白板也是 WPF,度量一致)
|
||||
Add-Type -AssemblyName PresentationCore
|
||||
Add-Type -AssemblyName WindowsBase
|
||||
$tf = New-Object System.Windows.Media.Typeface($Font)
|
||||
$items = Get-Content $InFile -Encoding UTF8 -Raw | ConvertFrom-Json
|
||||
$res = @{}
|
||||
foreach ($p in $items.PSObject.Properties) {
|
||||
$ft = New-Object System.Windows.Media.FormattedText(
|
||||
[string]$p.Value,
|
||||
[System.Globalization.CultureInfo]::GetCultureInfo("zh-CN"),
|
||||
[System.Windows.FlowDirection]::LeftToRight,
|
||||
$tf,
|
||||
$Size,
|
||||
[System.Windows.Media.Brushes]::Black,
|
||||
1.0)
|
||||
$res[$p.Name] = $ft.WidthIncludingTrailingWhitespace
|
||||
}
|
||||
$res | ConvertTo-Json -Depth 3 | Set-Content $OutFile -Encoding UTF8
|
||||
Write-Output "measured $($res.Count)"
|
||||
Reference in New Issue
Block a user