Skip to content

Deprecate passing Type1Font effects as dict #15896

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

Conversation

timhoffm
Copy link
Member

PR Summary

https://matplotlib.org/devdocs/api/type1font.html#matplotlib.type1font.Type1Font.transform has a peculiar API of passing two optional parameters as dict.

This PR deprecates that behavior and instead introduces two regular keyword arguments with default values.

PR Checklist

  • Code is Flake 8 compliant
  • Documentation is sphinx and numpydoc compliant
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@timhoffm timhoffm force-pushed the deprecate-type1font-transform-param branch from 77a6dee to 75ed591 Compare December 10, 2019 00:46
@timhoffm timhoffm force-pushed the deprecate-type1font-transform-param branch from 75ed591 to 572e4eb Compare December 10, 2019 00:49
Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

Actually I think the old API makes sense, effects is really just a lightweight object/namedtuple. If you track the callers you will see that ultimately effects comes from reading pdftex.map, which contain entries speficying font slant and extend, which always come as a single pair, not as separate things.

@timhoffm
Copy link
Member Author

Then the usage example at https://matplotlib.org/api/type1font.html#module-matplotlib.type1font is misleading because it's not actual a use case? It explicitly creates single-item tuples and passes them to the function.

@anntzer
Copy link
Contributor

anntzer commented Dec 10, 2019

Sorry, I guess my comment was slightly misleading. The entries in pdftex.map don't necessarily specify both sland and extend, the idea is more that the two of them (or only one of them, if only one of them exists) are carried together as a dict through multiple functions and it doesn't make sense to split them at the last minute.

@timhoffm
Copy link
Member Author

Will decide later if I want to follow up on this.

@anntzer
Copy link
Contributor

anntzer commented Dec 15, 2019

at least the (independent) docstring cleanups are fine by themselves.

@anntzer
Copy link
Contributor

anntzer commented Dec 15, 2019

(I guess one could introduce a namedtuple to represent the slant/extend pair, but that feels a bit overengineered to me -- there's some level at which dicts are just fine...)

@timhoffm
Copy link
Member Author

Not going to fight over this.

@timhoffm timhoffm closed this Dec 19, 2019
@timhoffm timhoffm deleted the deprecate-type1font-transform-param branch December 19, 2019 07:18
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.

2 participants