한글 서브셋 출처: https://github.com/nacyot/korean_subset_glyphs
Requirements #
fonttools, zopfli, brotli
1pip install fonttools zopfli brotli
스크립트 #
1param (
2 [string]$InputPath,
3 [string]$OutputPath="."
4)
5
6$glyphs=$(curl -L https://raw.githubusercontent.com/nacyot/korean_subset_glyphs/master/glyphs.txt);
7
8$cmd = {
9 param ($file, $out, $glyphs)
10 Write-Output "$($file.FullName) -> $out";
11 pyftsubset "$($file.FullName)" --output-file=$out --text="$glyphs" --flavor="woff" --with-zopfli --layout-features='*' --glyph-names --symbol-cmap --legacy-cmap --notdef-glyph --notdef-outline --recommended-glyphs --name-legacy --drop-tables= --name-IDs='*' --name-languages='*'
12}
13
14$jobs = @()
15
16foreach ($file in $(Get-ChildItem $InputPath)) {
17 $out="$OutputPath$($file.Name.Split('.')[0]).subset.woff2";
18
19 $jobs += Start-Job -ScriptBlock $cmd -ArgumentList $file, $out, $glyphs
20}
21
22Wait-Job -Job $jobs |Out-Null
23Receive-Job -Job $jobs