diff options
author | Rasmus Andersson <rasmus@notion.se> | 2024-05-24 02:50:44 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2024-05-24 02:50:44 +0300 |
commit | f054332d554220ba0650901ea0b43b20c88fc529 (patch) | |
tree | 2aa50c6e8aeff1aa94b046f810f3e67bbc524853 | |
parent | c0c503302af8c9ed81d3ad32ad78633f45bf1cd2 (diff) | |
download | inter-f054332d554220ba0650901ea0b43b20c88fc529.tar.xz |
tools/bake-vf.py: exit with error if fvar table has unexpected values
-rw-r--r-- | misc/tools/bake-vf.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/misc/tools/bake-vf.py b/misc/tools/bake-vf.py index fdacad175..fe9320aa4 100644 --- a/misc/tools/bake-vf.py +++ b/misc/tools/bake-vf.py @@ -331,14 +331,16 @@ def gen_stat(ttfont): def check_fvar(ttfont): fvar = ttfont['fvar'] - error = False + ok = True for i in fvar.instances: actual_wght = i.coordinates['wght'] expected_wght = round(actual_wght / 100) * 100 if expected_wght != actual_wght: - print(f"unexpected wght {actual_wght} (expected {expected_wght})", - ttfont, i.coordinates) - error = True + print(f"BAD wght {actual_wght} (expected {expected_wght})", i.coordinates) + ok = False + # else: + # print(f"OK wght {actual_wght}", i.coordinates) + return ok # def fixup_fvar(ttfont): @@ -372,6 +374,8 @@ def main(): # load font ttfont = TTFont(args.input, recalcBBoxes=False, recalcTimestamp=False) + if not check_fvar(ttfont): + sys.exit(1) # infer axis extremes global OPSZ_MIN @@ -397,7 +401,8 @@ def main(): gen_stat(ttfont) # check fvar table - check_fvar(ttfont) + if not check_fvar(ttfont): + sys.exit(1) # # fixup OS/2 table (set usWeightClass) # fixup_os2(ttfont) |