Changeset 171
- Timestamp:
- 04/04/08 06:57:19 (9 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
packages/feaTools/trunk/Lib/feaTools/writers/fdkSyntaxWriter.py
r111 r171 66 66 return lookup 67 67 68 def lookupReference(self, name): 69 t = "lookup %s;" % name 70 self._instructions.append(t) 71 68 72 def classDefinition(self, name, contents): 69 73 t = "%s = [%s];" % (name, self._list2String(contents)) … … 94 98 self._instructions.append(t) 95 99 96 def gsubType6(self, precedingContext, target, trailingContext, replacement ):100 def gsubType6(self, precedingContext, target, trailingContext, replacement, ignore=False): 97 101 if isinstance(precedingContext, list): 98 102 precedingContext = self._list2String(precedingContext) 99 103 if isinstance(target, list): 100 target = [i + "'" for i in target]101 104 target = self._list2String(target) 105 target += "'" 102 106 if isinstance(trailingContext, list): 103 107 trailingContext = self._list2String(trailingContext) 104 108 if isinstance(replacement, list): 105 109 replacement = self._list2String(replacement) 106 if precedingContext and trailingContext: 107 t = "sub %s %s %s by %s;" % (precedingContext, target, trailingContext, replacement) 108 elif precedingContext: 109 t = "sub %s %s by %s;" % (precedingContext, target, replacement) 110 elif trailingContext: 111 t = "sub %s %s by %s;" % (target, trailingContext, replacement) 110 if ignore: 111 if precedingContext and trailingContext: 112 t = "ignore sub %s %s %s;" % (precedingContext, target, trailingContext) 113 elif precedingContext: 114 t = "ignore sub %s %s;" % (precedingContext, target) 115 elif trailingContext: 116 t = "ignore sub %s %s;" % (target, trailingContext) 117 else: 118 t = "ignore sub %s;" % target 112 119 else: 113 t = "sub %s by %s;" % (target, replacement) 120 if precedingContext and trailingContext: 121 t = "sub %s %s %s by %s;" % (precedingContext, target, trailingContext, replacement) 122 elif precedingContext: 123 t = "sub %s %s by %s;" % (precedingContext, target, replacement) 124 elif trailingContext: 125 t = "sub %s %s by %s;" % (target, trailingContext, replacement) 126 else: 127 t = "sub %s by %s;" % (target, replacement) 114 128 self._instructions.append(t) 115 129 … … 134 148 135 149 def languageSystem(self, languageTag, scriptTag): 136 t = "languagesystem %s %s;" % ( languageTag, scriptTag)150 t = "languagesystem %s %s;" % (scriptTag, languageTag) 137 151 self._instructions.append(t) 138 152 … … 151 165 t = "include(%s)" % path 152 166 self._instructions.append(t) 167 168 def subtableBreak(self): 169 t = "subtable;" 170 self._instructions.append(t) 171
