From: Ben Harris Date: Sat, 14 Dec 2024 16:04:46 +0000 (+0000) Subject: Add a script to check backward compatibility X-Git-Tag: bedstead-3.251~73 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~bjharris/git?a=commitdiff_plain;h=ba81f7454c28c0679543ec8feb3863e4e0ab4e5a;p=bedstead.git Add a script to check backward compatibility --- diff --git a/HACKING b/HACKING index 42220bc..95e86cb 100644 --- a/HACKING +++ b/HACKING @@ -77,6 +77,9 @@ Bedstead's history to their correct forms. NOTES - Disorganised jottings about Bedstead and related matters. +compatcheck - A script to compare two versions of Bedstead OTF files +and report backward incompatibilities. + editor - An interactive editor for Bedstead character shapes. Written by Simon Tatham and released under CC0. diff --git a/compatcheck b/compatcheck new file mode 100755 index 0000000..e96e766 --- /dev/null +++ b/compatcheck @@ -0,0 +1,28 @@ +#! /usr/bin/python3 + +# SPDX-License-Identifier: CC0-1.0 + +from argparse import ArgumentParser +from fontTools import ttLib +from sys import exit + +parser = ArgumentParser() +parser.add_argument("old") +parser.add_argument("new") + +cfg = parser.parse_args() + +ttold = ttLib.TTFont(cfg.old) +ttnew = ttLib.TTFont(cfg.new) + +failed = False + +def fail(msg): + print(f"FAIL: {msg}") + +if not (set(ttold.getGlyphOrder()) <= set(ttnew.getGlyphOrder())): + fail("Glyphs vanished: " + f"{set(ttold.getGlyphOrder()) - set(ttnew.getGlyphOrder())!r}") + +if failed: + exit(1)