Skip to content
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

Fix default Roboto font not being found by the matplotlib FontManager #116

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions sphinxext/opengraph/socialcards.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ def create_social_card_objects(
"""Create the Matplotlib objects for the first time."""
# If no font specified, load the Roboto Flex font as a fallback
if font is None:
path_font = Path(__file__).parent / "_static/Roboto-flex.ttf"
path_font = Path(__file__).parent / "_static/Roboto-Flex.ttf"
roboto_font = matplotlib.font_manager.FontEntry(
fname=str(path_font), name="Roboto"
fname=str(path_font), name="Roboto Flex"
)
matplotlib.font_manager.fontManager.ttflist.append(roboto_font)
matplotlib.font_manager.fontManager.addfont(path_font)
font = roboto_font.name

# Because Matplotlib doesn't let you specify figures in pixels, only inches
Expand Down