BabelRunInfo is information decompiled from a native context text line. It resembles as close a possible to original source that generated the the text line/run, but it will never be the same. E.g. any OT-feature glyph replacement cannot be reconstructed to the original string.
| 183 | |
| 184 | |
| 185 | class BabelRunInfo: |
| 186 | """BabelRunInfo is information decompiled from a native context text line. |
| 187 | It resembles as close a possible to original source that generated the the |
| 188 | text line/run, but it will never be the same. E.g. any OT-feature glyph |
| 189 | replacement cannot be reconstructed to the original string.""" |
| 190 | |
| 191 | def __init__(self, s, style, context, cRun=None): |
| 192 | assert isinstance(s, str) |
| 193 | self.s = s # Reconstructed string, may not be input for e.g. OT-features |
| 194 | self.style = style # Reconstructed style of the run. |
| 195 | #print(style) |
| 196 | self.context = context # Just in case it is needed |
| 197 | # Optional native "context run" |
| 198 | # (e.g. DrawBot-->CTRun instance. Flat-->) |
| 199 | self.cRun = cRun |
| 200 | |
| 201 | def __repr__(self): |
| 202 | return '<%s "%s">' % (self.__class__.__name__, self.s) |