From 641c59e9a6fd0982be44642abef774e69b55f784 Mon Sep 17 00:00:00 2001 From: Marcel Admiraal Date: Thu, 14 Dec 2023 13:55:19 +0200 Subject: [PATCH] Fix default Roboto font not being found by the matplotlib FontManager (#116) --- sphinxext/opengraph/socialcards.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinxext/opengraph/socialcards.py b/sphinxext/opengraph/socialcards.py index 81dec56..1bbafdc 100644 --- a/sphinxext/opengraph/socialcards.py +++ b/sphinxext/opengraph/socialcards.py @@ -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