Merge pull request #1961 from fonttools/feaLib-ast-compat

[feaLib.ast] Restore compatibility with 4.9.0
This commit is contained in:
Cosimo Lupo 2020-05-19 10:01:47 +01:00 committed by GitHub
commit e838cd8dca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 20 deletions

View File

@ -617,16 +617,24 @@ class ChainContextPosStatement(Statement):
``prefix``, ``glyphs``, and ``suffix`` should be lists of ``prefix``, ``glyphs``, and ``suffix`` should be lists of
`glyph-containing objects`_ . `glyph-containing objects`_ .
``lookups`` should be a list of lists containing :class:`LookupBlock` ``lookups`` should be a list of elements representing what lookups
statements. The length of the outer list should equal to the length of to apply at each glyph position. Each element should be a
``glyphs``; the inner lists can be of variable length. Where there is no :class:`LookupBlock` to apply a single chaining lookup at the given
chaining lookup at the given glyph position, the entry in ``lookups`` position, a list of :class:`LookupBlock`\ s to apply multiple
should be ``None``.""" lookups, or ``None`` to apply no lookup. The length of the outer
list should equal the length of ``glyphs``; the inner lists can be
of variable length."""
def __init__(self, prefix, glyphs, suffix, lookups, location=None): def __init__(self, prefix, glyphs, suffix, lookups, location=None):
Statement.__init__(self, location) Statement.__init__(self, location)
self.prefix, self.glyphs, self.suffix = prefix, glyphs, suffix self.prefix, self.glyphs, self.suffix = prefix, glyphs, suffix
self.lookups = lookups self.lookups = list(lookups)
for i, lookup in enumerate(lookups):
if lookup:
try:
(_ for _ in lookup)
except TypeError:
self.lookups[i] = [lookup]
def build(self, builder): def build(self, builder):
"""Calls the builder's ``add_chain_context_pos`` callback.""" """Calls the builder's ``add_chain_context_pos`` callback."""
@ -662,14 +670,24 @@ class ChainContextSubstStatement(Statement):
``prefix``, ``glyphs``, and ``suffix`` should be lists of ``prefix``, ``glyphs``, and ``suffix`` should be lists of
`glyph-containing objects`_ . `glyph-containing objects`_ .
``lookups`` should be a list of :class:`LookupBlock` statements, with ``lookups`` should be a list of elements representing what lookups
length equal to the length of ``glyphs``. Where there is no chaining to apply at each glyph position. Each element should be a
lookup at the given glyph position, the entry in ``lookups`` should be :class:`LookupBlock` to apply a single chaining lookup at the given
``None``.""" position, a list of :class:`LookupBlock`\ s to apply multiple
lookups, or ``None`` to apply no lookup. The length of the outer
list should equal the length of ``glyphs``; the inner lists can be
of variable length."""
def __init__(self, prefix, glyphs, suffix, lookups, location=None): def __init__(self, prefix, glyphs, suffix, lookups, location=None):
Statement.__init__(self, location) Statement.__init__(self, location)
self.prefix, self.glyphs, self.suffix = prefix, glyphs, suffix self.prefix, self.glyphs, self.suffix = prefix, glyphs, suffix
self.lookups = lookups self.lookups = list(lookups)
for i, lookup in enumerate(lookups):
if lookup:
try:
(_ for _ in lookup)
except TypeError:
self.lookups[i] = [lookup]
def build(self, builder): def build(self, builder):
"""Calls the builder's ``add_chain_context_subst`` callback.""" """Calls the builder's ``add_chain_context_subst`` callback."""

View File

@ -201,15 +201,15 @@ In alphabetical order:
Olivier Berten, Samyak Bhuta, Erik van Blokland, Petr van Blokland, Olivier Berten, Samyak Bhuta, Erik van Blokland, Petr van Blokland,
Jelle Bosma, Sascha Brawer, Tom Byrer, Frédéric Coiffier, Vincent Jelle Bosma, Sascha Brawer, Tom Byrer, Frédéric Coiffier, Vincent
Connare, Dave Crossland, Simon Daniels, Peter Dekkers, Behdad Esfahbod, Connare, David Corbett, Dave Crossland, Simon Daniels, Peter Dekkers,
Behnam Esfahbod, Hannes Famira, Sam Fishman, Matt Fontaine, Yannis Behdad Esfahbod, Behnam Esfahbod, Hannes Famira, Sam Fishman, Matt
Haralambous, Greg Hitchcock, Jeremie Hornus, Khaled Hosny, John Hudson, Fontaine, Yannis Haralambous, Greg Hitchcock, Jeremie Hornus, Khaled
Denis Moyogo Jacquerye, Jack Jansen, Tom Kacvinsky, Jens Kutilek, Hosny, John Hudson, Denis Moyogo Jacquerye, Jack Jansen, Tom Kacvinsky,
Antoine Leca, Werner Lemberg, Tal Leming, Peter Lofting, Cosimo Lupo, Jens Kutilek, Antoine Leca, Werner Lemberg, Tal Leming, Peter Lofting,
Masaya Nakamura, Dave Opstad, Laurence Penney, Roozbeh Pournader, Garret Cosimo Lupo, Masaya Nakamura, Dave Opstad, Laurence Penney, Roozbeh
Rieger, Read Roberts, Guido van Rossum, Just van Rossum, Andreas Seidel, Pournader, Garret Rieger, Read Roberts, Guido van Rossum, Just van
Georg Seifert, Chris Simpkins, Miguel Sousa, Adam Twardoch, Adrien Tétar, Vitaly Volkov, Rossum, Andreas Seidel, Georg Seifert, Chris Simpkins, Miguel Sousa,
Paul Wise. Adam Twardoch, Adrien Tétar, Vitaly Volkov, Paul Wise.
Copyrights Copyrights
~~~~~~~~~~ ~~~~~~~~~~