-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
Description
Question
summary
I'd like to use FontManager.addfont
because the following warning is displayed
/pathee/spotlist-api/app/server_business/services/mail_graph_service.py:12: MatplotlibDeprecationWarning:
The createFontList function was deprecated in Matplotlib 3.2 and will be removed two minor releases later. Use FontManager.addfont instead.
But I don't know how to use the method.
Code for reproduction
from matplotlib import font_manager
font_dirs = ["/resources/fonts"]
font_files = font_manager.findSystemFonts(fontpaths=font_dirs)
custom_font_manager = font_manager.FontManager()
for font_file in font_files:
custom_font_manager.addfont(font_file)
result = custom_font_manager.findfont("IPAGothic")
print(result)
# /resources/fonts/ipag.ttf
Actual outcome
Not work.
matplotlib.pyplot.rcParams['font.family'] = "IPAGothic"
# findfont: Font family ['IPAGothic'] not found. Falling back to DejaVu Sans.
Expected outcome
findfont: Font family ['IPAGothic'] not found
is solved
Matplotlib version
- Matplotlib version: 3.2
- Python version: 3.6.6
thijstriemstra