diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-25 09:32:21 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-12-25 09:46:53 +0300 |
commit | 2f83984f3c96794039f6d577c2dc3eea220dbca0 (patch) | |
tree | 958ca6af85dd936face825e7fba750a5144d4eaf /contrib/python/fonttools/fontTools/otlLib/builder.py | |
parent | f8fcb8a9bf119d91c13270ce72f2bbe35bafe0d3 (diff) | |
download | ydb-2f83984f3c96794039f6d577c2dc3eea220dbca0.tar.gz |
Intermediate changes
commit_hash:c52dc7996a60242b5397523a3f8dada166c4c7c5
Diffstat (limited to 'contrib/python/fonttools/fontTools/otlLib/builder.py')
-rw-r--r-- | contrib/python/fonttools/fontTools/otlLib/builder.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/contrib/python/fonttools/fontTools/otlLib/builder.py b/contrib/python/fonttools/fontTools/otlLib/builder.py index 8fc685683a..b944ea8c26 100644 --- a/contrib/python/fonttools/fontTools/otlLib/builder.py +++ b/contrib/python/fonttools/fontTools/otlLib/builder.py @@ -1,4 +1,5 @@ from collections import namedtuple, OrderedDict +import itertools import os from fontTools.misc.fixedTools import fixedToFloat from fontTools.misc.roundTools import otRound @@ -798,6 +799,22 @@ class ChainContextSubstBuilder(ChainContextualBuilder): res = sub return res + def find_chainable_ligature_subst(self, glyphs, replacement): + """Helper for add_ligature_subst_chained_()""" + res = None + for rule in self.rules[::-1]: + if rule.is_subtable_break: + return res + for sub in rule.lookups: + if not isinstance(sub, LigatureSubstBuilder): + continue + if all( + sub.ligatures.get(seq, replacement) == replacement + for seq in itertools.product(*glyphs) + ): + res = sub + return res + class LigatureSubstBuilder(LookupBuilder): """Builds a Ligature Substitution (GSUB4) lookup. |