Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[ENH]: Fonts searching logic #28147

Copy link
Copy link
Open
Open
Copy link
@ChestnutA

Description

@ChestnutA
Issue body actions

Problem

I'm always frustrated while setting the fonts of text in plots. To begin with, I want the readers to be noticed that I do know a couple of ways to set fonts, and I am here just to give an advise.


I use Windows to be the environment here. The phenomenons are as follows.
The font.sans-serif property in file "matplotlibrc" in the "site-packages\matplotlib\mpl-data" directory is "DejaVu Sans, Bitstream Vera Sans, Computer Modern Sans Serif, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif, simkai". As you can see,

  • there is an item called "simkai" in it,
  • and "simkai.ttf" is located in both
    • site-packages\matplotlib\mpl-data\fonts\ttf
    • C:\Windows\fonts

However, Matplotlib is not able to find the font name, and raise the warning "findfont: Generic family 'sans-serif' not found because none of the following families were found: SimKai".

So, where could the user find and set it? There is a json file within the folder %Userprofile%\.matplotlib. The font "simkai.ttf" is named by "kaiti" in json.

On the contrary, after I set plt.rcParams['font.sans-serif']=['SimSun'], the font "simsun" could be recognized correctly. To be noticed, there are no font files named like "simsun*.ttf" in directories mentioned above. There is only a "C:\Windows\fonts\simsun.ttc".

Similar to what occurred with "kaiti", the way and the only way to recognize "simsun" is to search by the json file under %userprofile%.

I consider this searching mode to be wired and inconvenient.

Proposed solution

Maybe, the logic could be removed from the personal configuration on the system disk. Or add the behavior in User Guide?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.