MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_wx_font

Method get_wx_font

lib/matplotlib/backends/backend_wx.py:262–277  ·  view source on GitHub ↗

Return a wx font. Cache font instances for efficiency.

(self, s, prop)

Source from the content-addressed store, hash-verified

260 return self.gc
261
262 def get_wx_font(self, s, prop):
263 """Return a wx font. Cache font instances for efficiency."""
264 _log.debug("%s - get_wx_font()", type(self))
265 key = hash(prop)
266 font = self.fontd.get(key)
267 if font is not None:
268 return font
269 size = self.points_to_pixels(prop.get_size_in_points())
270 # Font colour is determined by the active wx.Pen
271 # TODO: It may be wise to cache font information
272 self.fontd[key] = font = wx.Font( # Cache the font and gc.
273 pointSize=round(size),
274 family=self.fontnames.get(prop.get_name(), wx.ROMAN),
275 style=self.fontangles[prop.get_style()],
276 weight=self.fontweights[prop.get_weight()])
277 return font
278
279 def points_to_pixels(self, points):
280 # docstring inherited

Callers 2

draw_textMethod · 0.95

Calls 5

points_to_pixelsMethod · 0.95
get_nameMethod · 0.80
get_styleMethod · 0.80
getMethod · 0.45
get_weightMethod · 0.45

Tested by

no test coverage detected