Clears the context cache, in case the string source changed, to force new calculation of context dependent wrapping. >>> from pagebot.contexts import getContext >>> context = getContext() >>> bs = BabelString('ABCD', dict(fontSize=24), context=context) >>> #
(self)
| 142 | context = property(_get_context, _set_context) |
| 143 | |
| 144 | def reset(self): |
| 145 | """Clears the context cache, in case the string source changed, to |
| 146 | force new calculation of context dependent wrapping. |
| 147 | |
| 148 | >>> from pagebot.contexts import getContext |
| 149 | >>> context = getContext() |
| 150 | >>> bs = BabelString('ABCD', dict(fontSize=24), context=context) |
| 151 | >>> # Triggers rendering of the FormattedString. |
| 152 | >>> bs.cs is not None |
| 153 | True |
| 154 | >>> bs.reset() # Reset the caching. |
| 155 | >>> bs._cs is None |
| 156 | True |
| 157 | """ |
| 158 | # Storage of native context string (e.g. Drawbot.FormattedString or |
| 159 | # FlatStringData, containing Strike/Paragraph/Text instances). |
| 160 | self._cs = None |
| 161 | self._lines = None # Cache of calculated meta info after line wrapping. |
| 162 | self._twh = None # Cache of calculated text width (self.tw, self.th) |
| 163 | self._pwh = None # Cache of calculated pixel width (self.pw, self.ph) |
| 164 | self._overflowStart = None # Line index where overflow starts. |
| 165 | self._overflowEnd = None # Line (non-inclusive) |
| 166 | |
| 167 | def _get_w(self): |
| 168 | """Answers the request width of this string. If None, no width is |
no outgoing calls
no test coverage detected