Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten RendererWx.get_wx_font. #15292

Merged
merged 1 commit into from Nov 5, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 18, 2019

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

self.fontd[key] = font

self.fontd[key] = font = wx.Font( # Cache the font and gc.
pointSize=round(self.points_to_pixels(prop.get_size_in_points())),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't round the same, but I'm not sure if it's important:

In [9]: for i in range(10): 
   ...:     i = i + 0.5 
   ...:     print(i, round(i), int(i + 0.5)) 
   ...:                                                                                                                                               
0.5 0 1
1.5 2 2
2.5 2 3
3.5 4 4
4.5 4 5
5.5 6 6
6.5 6 7
7.5 8 8
8.5 8 9
9.5 10 10

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, upon further testing wx.Font accepts floats just fine here so I just dropped the rounding (after all freetype accepts sizes in multiples of (1/64) so there's no reason to drop that info...).

@tacaswell tacaswell merged commit 8189978 into matplotlib:master Nov 5, 2019
@tacaswell tacaswell added this to the v3.3.0 milestone Nov 5, 2019
@anntzer anntzer deleted the wxfont branch November 5, 2019 10:25
QuLogic added a commit to QuLogic/matplotlib that referenced this pull request Jan 29, 2021
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants