44 lines
1.3 KiB
PowerShell
44 lines
1.3 KiB
PowerShell
# Source Han Sans Font Downloader
|
|
Write-Host "Downloading Source Han Sans fonts..." -ForegroundColor Cyan
|
|
|
|
$targetDir = "public/fonts/source-han-sans"
|
|
$baseUrl = "https://github.com/adobe-fonts/source-han-sans/raw/release/SubsetOTF/SC"
|
|
|
|
$fonts = @(
|
|
"SourceHanSansSC-Regular.otf",
|
|
"SourceHanSansSC-Medium.otf",
|
|
"SourceHanSansSC-Bold.otf"
|
|
)
|
|
|
|
# Create directory
|
|
if (-not (Test-Path $targetDir)) {
|
|
New-Item -ItemType Directory -Force -Path $targetDir | Out-Null
|
|
Write-Host "Created directory: $targetDir" -ForegroundColor Yellow
|
|
}
|
|
|
|
$success = 0
|
|
$failed = 0
|
|
|
|
foreach ($font in $fonts) {
|
|
$url = "$baseUrl/$font"
|
|
$output = Join-Path $targetDir $font
|
|
|
|
Write-Host "Downloading $font..." -ForegroundColor White
|
|
|
|
try {
|
|
Invoke-WebRequest -Uri $url -OutFile $output -ErrorAction Stop
|
|
$size = [math]::Round((Get-Item $output).Length / 1MB, 2)
|
|
Write-Host " Success! Size: $size MB" -ForegroundColor Green
|
|
$success++
|
|
} catch {
|
|
Write-Host " Failed: $($_.Exception.Message)" -ForegroundColor Red
|
|
$failed++
|
|
}
|
|
}
|
|
|
|
Write-Host "`nDownload complete!" -ForegroundColor Green
|
|
Write-Host "Success: $success | Failed: $failed" -ForegroundColor Cyan
|
|
Write-Host "`nNext steps:" -ForegroundColor Yellow
|
|
Write-Host "1. Restart dev server: npm run dev"
|
|
Write-Host "2. Verify fonts in browser DevTools"
|