Skip to content

Commit

Permalink
Fix default Roboto font not being found by the matplotlib FontManager (
Browse files Browse the repository at this point in the history
  • Loading branch information
madmiraal authored Dec 14, 2023
1 parent fa24601 commit 641c59e
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 641c59e

Please sign in to comment.