[feaLib] Support Python < 3.5 in previous commits

This commit is contained in:
Khaled Hosny 2019-02-26 20:21:48 +02:00
parent 7d03e93e67
commit c82fb8fa13
2 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,7 @@ from fontTools.feaLib.ast import FeatureFile
from fontTools.otlLib import builder as otl
from fontTools.ttLib import newTable, getTableModule
from fontTools.ttLib.tables import otBase, otTables
from collections import defaultdict
from collections import defaultdict, OrderedDict
import itertools
import logging
@ -1188,7 +1188,7 @@ class LookupBuilder(object):
class AlternateSubstBuilder(LookupBuilder):
def __init__(self, font, location):
LookupBuilder.__init__(self, font, location, 'GSUB', 3)
self.alternates = {}
self.alternates = OrderedDict()
def equals(self, other):
return (LookupBuilder.equals(self, other) and
@ -1315,7 +1315,7 @@ class ChainContextSubstBuilder(LookupBuilder):
class LigatureSubstBuilder(LookupBuilder):
def __init__(self, font, location):
LookupBuilder.__init__(self, font, location, 'GSUB', 4)
self.ligatures = {} # {('f','f','i'): 'f_f_i'}
self.ligatures = OrderedDict() # {('f','f','i'): 'f_f_i'}
def equals(self, other):
return (LookupBuilder.equals(self, other) and
@ -1333,7 +1333,7 @@ class LigatureSubstBuilder(LookupBuilder):
class MultipleSubstBuilder(LookupBuilder):
def __init__(self, font, location):
LookupBuilder.__init__(self, font, location, 'GSUB', 2)
self.mapping = {}
self.mapping = OrderedDict()
def equals(self, other):
return (LookupBuilder.equals(self, other) and
@ -1490,7 +1490,7 @@ class ReverseChainSingleSubstBuilder(LookupBuilder):
class SingleSubstBuilder(LookupBuilder):
def __init__(self, font, location):
LookupBuilder.__init__(self, font, location, 'GSUB', 1)
self.mapping = {}
self.mapping = OrderedDict()
def equals(self, other):
return (LookupBuilder.equals(self, other) and

View File

@ -513,6 +513,8 @@ class BuilderTest(unittest.TestCase):
addOpenTypeFeatures(font, tree)
assert "GSUB" in font
@unittest.skipIf(sys.version_info[0:2] < (3, 4),
"assertLogs() was introduced in 3.4")
def test_unsupported_subtable_break(self):
with self.assertLogs(level='WARNING') as logs:
self.build(