Skip to content

Commit 641c59e

Browse files
authored
Fix default Roboto font not being found by the matplotlib FontManager (#116)
1 parent fa24601 commit 641c59e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sphinxext/opengraph/socialcards.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ def create_social_card_objects(
183183
"""Create the Matplotlib objects for the first time."""
184184
# If no font specified, load the Roboto Flex font as a fallback
185185
if font is None:
186-
path_font = Path(__file__).parent / "_static/Roboto-flex.ttf"
186+
path_font = Path(__file__).parent / "_static/Roboto-Flex.ttf"
187187
roboto_font = matplotlib.font_manager.FontEntry(
188-
fname=str(path_font), name="Roboto"
188+
fname=str(path_font), name="Roboto Flex"
189189
)
190-
matplotlib.font_manager.fontManager.ttflist.append(roboto_font)
190+
matplotlib.font_manager.fontManager.addfont(path_font)
191191
font = roboto_font.name
192192

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

0 commit comments

Comments
 (0)