Skip to content

Improvements to make_icons.py. #14941

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

Merged
merged 1 commit into from
Aug 13, 2019
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 31, 2019

  • Auto-download and cache fontawesome otf.
  • Support writing results to another directory (useful when testing, to
    not mess with the repo).

Also, support for pathlib in font_manager (made necessary by the changes
in make_icons.py -- specifically, backend_pdf's internals don't handle
FontProperties.get_fname returning a Path).

Useful if you want to play with mplcairo wrt. #14939 (#14939 (comment)).

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

- Auto-download and cache fontawesome otf.
- Support writing results to another directory (useful when testing, to
  not mess with the repo).

Also, support for pathlib in font_manager (made necessary by the changes
in make_icons.py -- specifically, backend_pdf's internals don't handle
FontProperties.get_fname returning a Path).
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Just so that it has been said: This does not generate .ppm files anymore, which is fine by me.


fig = plt.figure(figsize=(1, 1))
fig.patch.set_alpha(0.0)
text = fig.text(0.5, 0.48, chr(ccode), ha='center', va='center',
fontproperties=prop)
text.set_path_effects([patheffects.Normal()])
Copy link
Member

Choose a reason for hiding this comment

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

I assume this did not have any effect, so removing is fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intent was probably to force the text to be rendered as a bezier rather than relying on a font file that may not exist in the end user's computer, but we set svg.fonttype to path so that also does the conversion, and the pdf backend takes care of embedding the font, so we should be good?

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand the details here, so relying on your investigation. But your question mark makes me wonder how sure you are...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at the code of patheffects.py I'm fairly confident that the description is correct, but to know what the original intent was, we would need to get @mdboom's input, if he still lurks aroud...

@tacaswell tacaswell added this to the v3.2.0 milestone Aug 8, 2019
Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Looks good (modulo the patheffects removal). Personally, I'd be defensive and leave this in because I don't understand that. But @tacaswell has approved and if you think, this is fine we can also go as is.

@dstansby dstansby merged commit 3419465 into matplotlib:master Aug 13, 2019
@anntzer anntzer deleted the make_icons branch August 13, 2019 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants