Hi, I’m trying to load a custom font inside a JupyterLab widget, namely Plotly. From my initial searches on this topic, I find discussions about how to customize the fonts in the JupyterLab UI, but this isn’t what I’m trying accomplish. Instead, I want to display a Plotly FigureWidget where the plot title and axes use a font which is not loaded by JL’s default css.
When I display a FigureWidget with an undefined font, it falls back to a generic font. My current workaround is to evaluate a notebook cell with something like
display(HTML(""" <link href='https://fonts.googleapis.com/css?family=Questrial' rel='stylesheet' type='text/css'> <link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'> """))
The widget then refreshes to display the correct font.
Is there a good way to have a collection of predefined fonts load when JupyterLab starts? Also, I would prefer to host the font files on the JupyterLab server rather than from a CDN. Any tips on how to start would be greatly appreciated. Thanks!