2015-08-01 14:49:19 +02:00
|
|
|
from __future__ import print_function, division, absolute_import
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class Statement(object):
|
|
|
|
def __init__(self, location):
|
|
|
|
self.location = location
|
2015-08-01 14:49:19 +02:00
|
|
|
|
2015-09-04 15:06:11 +02:00
|
|
|
def build(self, builder):
|
|
|
|
pass
|
|
|
|
|
2015-08-01 14:49:19 +02:00
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class Block(Statement):
|
|
|
|
def __init__(self, location):
|
|
|
|
Statement.__init__(self, location)
|
|
|
|
self.statements = []
|
|
|
|
|
|
|
|
def build(self, builder):
|
|
|
|
for s in self.statements:
|
|
|
|
s.build(builder)
|
|
|
|
|
|
|
|
|
|
|
|
class FeatureFile(Block):
|
|
|
|
def __init__(self):
|
|
|
|
Block.__init__(self, location=None)
|
|
|
|
|
|
|
|
|
|
|
|
class FeatureBlock(Block):
|
2015-08-11 15:28:59 +02:00
|
|
|
def __init__(self, location, name, use_extension):
|
2015-09-04 16:11:53 +02:00
|
|
|
Block.__init__(self, location)
|
2015-08-11 15:28:59 +02:00
|
|
|
self.name, self.use_extension = name, use_extension
|
2015-08-01 19:58:54 +02:00
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class LookupBlock(Block):
|
2015-08-11 10:59:26 +02:00
|
|
|
def __init__(self, location, name, use_extension):
|
2015-09-04 16:11:53 +02:00
|
|
|
Block.__init__(self, location)
|
2015-08-11 10:59:26 +02:00
|
|
|
self.name, self.use_extension = name, use_extension
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class GlyphClassDefinition(Statement):
|
2015-08-01 17:34:02 +02:00
|
|
|
def __init__(self, location, name, glyphs):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-01 17:34:02 +02:00
|
|
|
self.name = name
|
|
|
|
self.glyphs = glyphs
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class AlternateSubstitution(Statement):
|
2015-08-11 15:54:54 +02:00
|
|
|
def __init__(self, location, glyph, from_class):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-11 15:54:54 +02:00
|
|
|
self.glyph, self.from_class = (glyph, from_class)
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class AnchorDefinition(Statement):
|
2015-08-11 12:53:30 +02:00
|
|
|
def __init__(self, location, name, x, y, contourpoint):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-11 12:53:30 +02:00
|
|
|
self.name, self.x, self.y, self.contourpoint = name, x, y, contourpoint
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class LanguageStatement(Statement):
|
2015-08-10 16:30:10 +02:00
|
|
|
def __init__(self, location, language, include_default, required):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-10 16:30:10 +02:00
|
|
|
self.language = language
|
|
|
|
self.include_default = include_default
|
|
|
|
self.required = required
|
2015-08-10 11:30:47 +02:00
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class LanguageSystemStatement(Statement):
|
2015-08-01 14:49:19 +02:00
|
|
|
def __init__(self, location, script, language):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-01 14:49:19 +02:00
|
|
|
self.script, self.language = (script, language)
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
def build(self, builder):
|
|
|
|
builder.add_language_system(self.location, self.script, self.language)
|
|
|
|
|
2015-08-04 11:01:04 +02:00
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class IgnoreSubstitutionRule(Statement):
|
2015-08-05 10:41:04 +02:00
|
|
|
def __init__(self, location, prefix, glyphs, suffix):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-05 10:41:04 +02:00
|
|
|
self.prefix, self.glyphs, self.suffix = (prefix, glyphs, suffix)
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class LookupReferenceStatement(Statement):
|
2015-08-11 10:59:26 +02:00
|
|
|
def __init__(self, location, lookup):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-11 10:59:26 +02:00
|
|
|
self.location, self.lookup = (location, lookup)
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class ScriptStatement(Statement):
|
2015-08-10 16:30:10 +02:00
|
|
|
def __init__(self, location, script):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-10 16:30:10 +02:00
|
|
|
self.script = script
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class SubtableStatement(Statement):
|
2015-08-11 15:14:47 +02:00
|
|
|
def __init__(self, location):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-11 15:14:47 +02:00
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class SubstitutionRule(Statement):
|
2015-08-04 19:55:55 +02:00
|
|
|
def __init__(self, location, old, new):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
|
|
|
self.old, self.new = (old, new)
|
2015-08-04 19:55:55 +02:00
|
|
|
self.old_prefix = []
|
|
|
|
self.old_suffix = []
|
2015-08-11 12:22:07 +02:00
|
|
|
self.lookups = [None] * len(old)
|
2015-08-04 19:55:55 +02:00
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class ValueRecord(Statement):
|
2015-08-04 11:01:04 +02:00
|
|
|
def __init__(self, location, xPlacement, yPlacement, xAdvance, yAdvance):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-04 11:01:04 +02:00
|
|
|
self.xPlacement, self.yPlacement = (xPlacement, yPlacement)
|
|
|
|
self.xAdvance, self.yAdvance = (xAdvance, yAdvance)
|
|
|
|
|
|
|
|
|
2015-09-04 16:11:53 +02:00
|
|
|
class ValueRecordDefinition(Statement):
|
2015-08-04 11:01:04 +02:00
|
|
|
def __init__(self, location, name, value):
|
2015-09-04 16:11:53 +02:00
|
|
|
Statement.__init__(self, location)
|
2015-08-04 11:01:04 +02:00
|
|
|
self.name = name
|
|
|
|
self.value = value
|