Commit 43bbf7e2 authored by Kaushal Modi's avatar Kaushal Modi

Generate WOFF2 from WOFF

parent 6a9a5e52
#!/usr/bin/env bash
# Time-stamp: <2018-07-11 22:28:47 kmodi>
# Time-stamp: <2018-07-11 23:38:49 kmodi>
# https://github.com/be5invis/Iosevka/issues/238#issuecomment-351527918
# pyftsubset - https://github.com/fonttools/fonttools
......@@ -29,6 +29,8 @@ common_args='--layout-features=""'
run_pyftsubset () {
font="${1}"
unicodes="${2}"
# out_dir_base="../../static/fonts"
# out_dir="${out_dir_base}/${font}/subset"
out_dir="../../static/fonts/${font}/subset"
mkdir -p "${out_dir}"
......@@ -48,20 +50,20 @@ run_pyftsubset () {
fi
done
echo "${font}: Generating subset WOFF2 files .."
for file in ${font}/ttf/*
echo "${font}: Converting the subset WOFF files to WOFF2 .."
for file in ${out_dir}/*
do
tmp="${file##*/}"
basename_no_ext="${tmp%.*}"
if [[ $file == *.ttf ]] # The ${font}/ttf HAS to contain .ttf font files.
if [[ $file == *.woff ]] # The ${out_dir} HAS to contain .woff font files.
then
eval "pyftsubset ${file} ${common_args} --flavor=woff2 --output-file=${out_dir}/${basename_no_ext}.woff2"
fi
done
}
# run_pyftsubset "libre-baskerville/2012" "U+0020-007E,U+00A7-00BE,U+2000-205E,U+00C0-00FF"
# run_pyftsubset "andada/2013" "U+0020-007E,U+00A7-00BE,U+2000-205E"
run_pyftsubset "libre-baskerville/2012" "U+0020-007E,U+00A7-00BE,U+2000-205E,U+00C0-00FF"
run_pyftsubset "andada/2013" "U+0020-007E,U+00A7-00BE,U+2000-205E"
run_pyftsubset "merriweather/2.002" "U+0020-007E,U+00A7-00BE,U+2000-205E,U+00C0-00FF"
run_pyftsubset "source-sans-pro/2.020R-ro-1.075R-it" "U+0020-007E,U+00A7-00BE,U+2000-205E"
run_pyftsubset "linux-libertine/5.3.0" "U+0020-007E,U+00A7-00BE,U+2000-205E"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment