Skip to content

Commit

Permalink
wx: Use an integral font size.
Browse files Browse the repository at this point in the history
This is a very-small partial revert of matplotlib#15292, which claimed that wx
supports floats, but this no longer appears to be the case with Python
3.10, and looking at the C++ class constructor [1], should not have ever
been supported.

[1] https://docs.wxwidgets.org/3.0/classwx_font.html
  • Loading branch information
QuLogic committed Jan 29, 2021
1 parent dbe3622 commit 62ffa6f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/matplotlib/backends/backend_wx.py
Expand Up @@ -297,10 +297,11 @@ def get_wx_font(self, s, prop):
font = self.fontd.get(key)
if font is not None:
return font
size = self.points_to_pixels(prop.get_size_in_points())
# Font colour is determined by the active wx.Pen
# TODO: It may be wise to cache font information
self.fontd[key] = font = wx.Font( # Cache the font and gc.
pointSize=self.points_to_pixels(prop.get_size_in_points()),
pointSize=int(size + 0.5),
family=self.fontnames.get(prop.get_name(), wx.ROMAN),
style=self.fontangles[prop.get_style()],
weight=self.fontweights[prop.get_weight()])
Expand Down

0 comments on commit 62ffa6f

Please sign in to comment.