MCPcopy Create free account
hub / github.com/PageBot/PageBot / reset

Method reset

Lib/pagebot/contexts/basecontext/babelstring.py:144–165  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 15

_set_contextMethod · 0.95
_set_wMethod · 0.95
_set_hMethod · 0.95
addMethod · 0.95
__add__Method · 0.95
_set_fontMethod · 0.95
_set_fontSizeMethod · 0.95
_set_leadingMethod · 0.95
_set_trackingMethod · 0.95
_set_xAlignMethod · 0.95
_set_yAlignMethod · 0.95
_set_baselineShiftMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected