aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/feaLib/ast.py
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2019-03-26 08:47:40 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-26 08:47:40 -0700
commit195ed3228f2e5c0f6a9cc31e9c0f081646eda9eb (patch)
treefd26782cbbf4c73650f8c5b42ebcb2b2e2b2be10 /Lib/fontTools/feaLib/ast.py
parent77fd69e027ae38cec03417f137ac09d98ca3d42a (diff)
parenta2a985d8342c1e502031a5232f1ce51fee03f608 (diff)
downloadfonttools-195ed3228f2e5c0f6a9cc31e9c0f081646eda9eb.tar.gz
Upgrade fonttools to 3.39.0
am: a2a985d834 Change-Id: Id1604aa430c5f0d93e7808c37ff0906fe72410a1
Diffstat (limited to 'Lib/fontTools/feaLib/ast.py')
-rw-r--r--Lib/fontTools/feaLib/ast.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/Lib/fontTools/feaLib/ast.py b/Lib/fontTools/feaLib/ast.py
index 7bf64981..39dc4bcf 100644
--- a/Lib/fontTools/feaLib/ast.py
+++ b/Lib/fontTools/feaLib/ast.py
@@ -821,19 +821,20 @@ class LookupFlagStatement(Statement):
markAttach, markFilter)
def asFea(self, indent=""):
- res = "lookupflag"
+ res = []
flags = ["RightToLeft", "IgnoreBaseGlyphs", "IgnoreLigatures", "IgnoreMarks"]
curr = 1
for i in range(len(flags)):
if self.value & curr != 0:
- res += " " + flags[i]
+ res.append(flags[i])
curr = curr << 1
if self.markAttachment is not None:
- res += " MarkAttachmentType {}".format(self.markAttachment.asFea())
+ res.append("MarkAttachmentType {}".format(self.markAttachment.asFea()))
if self.markFilteringSet is not None:
- res += " UseMarkFilteringSet {}".format(self.markFilteringSet.asFea())
- res += ";"
- return res
+ res.append("UseMarkFilteringSet {}".format(self.markFilteringSet.asFea()))
+ if not res:
+ res = ["0"]
+ return "lookupflag {};".format(" ".join(res))
class LookupReferenceStatement(Statement):
@@ -905,20 +906,24 @@ class MarkMarkPosStatement(Statement):
class MultipleSubstStatement(Statement):
- def __init__(self, prefix, glyph, suffix, replacement, location=None):
+ def __init__(
+ self, prefix, glyph, suffix, replacement, forceChain=False, location=None
+ ):
Statement.__init__(self, location)
self.prefix, self.glyph, self.suffix = prefix, glyph, suffix
self.replacement = replacement
+ self.forceChain = forceChain
def build(self, builder):
prefix = [p.glyphSet() for p in self.prefix]
suffix = [s.glyphSet() for s in self.suffix]
builder.add_multiple_subst(
- self.location, prefix, self.glyph, suffix, self.replacement)
+ self.location, prefix, self.glyph, suffix, self.replacement,
+ self.forceChain)
def asFea(self, indent=""):
res = "sub "
- if len(self.prefix) or len(self.suffix):
+ if len(self.prefix) or len(self.suffix) or self.forceChain:
if len(self.prefix):
res += " ".join(map(asFea, self.prefix)) + " "
res += asFea(self.glyph) + "'"
@@ -1088,7 +1093,7 @@ class SubtableStatement(Statement):
builder.add_subtable_break(self.location)
def asFea(self, indent=""):
- return indent + "subtable;"
+ return "subtable;"
class ValueRecord(Expression):