File: fix.py

package info (click to toggle)
fonts-sn-pro 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 13,876 kB
  • sloc: python: 17; makefile: 15; sh: 11
file content (19 lines) | stat: -rw-r--r-- 663 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import glob
from fontTools.ttLib import TTFont
from fontbakery.constants import (
    MacStyle,
    FsSelection,
)

if __name__ == "__main__":

    for font_path in glob.glob("../fonts/variable/*Italic*.ttf"):
        with open(font_path, "rb") as f:
            print("Fix italic naming in {}".format(font_path))
            ttFont = TTFont(f)
            ttFont["head"].macStyle = MacStyle.ITALIC
            ttFont["OS/2"].fsSelection = FsSelection.USETYPOMETRICS | FsSelection.ITALIC
            ttFont["post"].italicAngle = -9
            ttFont["hhea"].caretSlopeRise = 1000
            ttFont["hhea"].caretSlopeRun = 158
            ttFont.save(font_path)