8000 Numpydocify FontManager.findfont() by timhoffm · Pull Request #13815 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Numpydocify FontManager.findfont() #13815

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
Apr 2, 2019
Merged

Conversation

timhoffm
Copy link
Member
@timhoffm timhoffm commented Mar 31, 2019

PR Summary

Texts are mainly taken from the original docstring, but some of them are not quite clear yet. See below.

If somebody wants to immediately enhance the docstring, direct pushes are welcome.


Parameters
----------
prop : `~matplotlib.fontmanager.FontProperties`
Copy link
Member Author
@timhoffm timhoffm Mar 31, 2019

Choose a reason for hiding this comment

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

Apparently, this supports strings as well. I can do findfont('Calibri') or findfont('Calibri:bold') what is the correct terminology for the string representation?

Copy link
Contributor

Choose a reason for hiding this comment

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

it's a "fontconfig pattern" (mentioned elsewhere in the module).

----------
prop : `~matplotlib.fontmanager.FontProperties`
The font properties to search for.
fontext : str, optional, default: 'ttf'
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we support extensions other than 'ttf' and 'afm'?

The code says:

        if fontext == 'afm':
            fontlist = self.afmlist
        else:
            fontlist = self.ttflist

Not sure if extensions other than 'ttf' can appear in self.ttflist.

Copy link
Contributor

Choose a reason for hiding this comment

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

Really it's "ttf"->TrueType & OpenType (.ttf, .ttc, .otf) and "afm"->Adobe Font Metrics (.afm) (see get_fontext_synonyms).

If given, only search this directory and its subdirectories.
fallback_to_default : bool
If True, will fallback to the default font family (usually
"DejaVu Sans" or "Helvetica") if the first lookup hard-fails.
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't quite understand the behavior for fallback_to_default=False. This also returns "DejaVu Sans". Not sure if this is a bug. Anyway, we're missing documentation for the non-fallback result.

Copy link
Contributor

Choose a reason for hiding this comment

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

In one case we still try to match the font size, weight, and style (italic, bold, etc.) but not in the other. TBH I doubt the distinction really matters and would suggest just deprecating that argument (can be done in a separate PR, of course).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok. I'll take care of that later in a separate PR.

@anntzer anntzer added this to the v3.1.0 milestone Apr 2, 2019
@anntzer anntzer merged commit 8be01cc into matplotlib:master Apr 2, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Apr 2, 2019
tacaswell added a commit that referenced this pull request Apr 2, 2019
…815-on-v3.1.x

Backport PR #13815 on branch v3.1.x (Numpydocify FontManager.findfont())
@timhoffm timhoffm deleted the doc-findfont branch April 2, 2019 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0