File: build_WOFF.py

package info (click to toggle)
fonts-cascadia-code 2102.03-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 28,768 kB
  • sloc: python: 1,949; sh: 12; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 524 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import sys
from pathlib import Path

from fontTools import ttLib

for file in Path("build").glob("*.ttf"):
    ttfile = ttLib.TTFont(file)

    if "TSI0" in ttfile:
        print(f"[{file}] – ERROR: VTT production tables present, WOFF not generated")
        print("Please ship from VTT")
    else:
        print(f"{file}: Generating WOFF2")
        ttfile.flavor = "woff2"
        ttfile.save(file.with_suffix(".woff2"))

print("All done")
print("*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***")