# depend on the behaviour of particular inputs to these lookups, and
# that they should thus be consistent within major versions. Unlike
# for most features above, we'd like to check that the semantics of
-# the chosen glyphs haven't changed. For now, we do that by checking
-# glyph names. The only feature currently handled by this is 'aalt'
-# (Access All Alternates).
+# the chosen glyphs haven't changed. This is made tricky by the fact
+# the Bedstead 3.251 changed some glyph names while keeping the same
+# semantics, and also changed the shape of some glyphs. Our approach
+# is to look up both old and new glyph names in the new font and check
+# that they have the same outline there. The only feature currently
+# handled by this is 'aalt' (Access All Alternates).
from argparse import ArgumentParser
from fontTools import ttLib
for st in lookup.SubTable:
return st.alternates
+def charstring(glyphname):
+ return ttnew['CFF '].cff[0].CharStrings[glyphname].bytecode
+
for feat in ['aalt']:
oldalt = feat_to_dict(ttold['GSUB'], feat)
newalt = feat_to_dict(ttnew['GSUB'], feat)
for k in sorted(set(oldalt.keys()) & set(newalt.keys())):
- if newalt[k][:len(oldalt[k])] != oldalt[k]:
+ if ([charstring(x) for x in newalt[k][:len(oldalt[k])]] !=
+ [charstring(x) for x in oldalt[k]]):
fail(f"new '{feat}' lookup for {k} is not a prefix of old one")
if failed: