Jupyter-themes: How to use custom .ttf files for fonts?

Created on 6 Dec 2018  ·  5Comments  ·  Source: dunovank/jupyter-themes

I tried adding the .ttf files to "fonts" directories. It would be great if I could just add the files following the correct folder structure and nomenclature and just use it.

Log:
One of the fonts you requested is not available
Setting all fonts to default
Traceback (most recent call last):

File "/Users/christina/anaconda3/bin/jt", line 10, in
sys.exit(main())

File "/Users/christina/anaconda3/lib/python3.6/site-packages/jupyterthemes/__init__.py", line 314, in main
dfonts=args.defaultfonts)

File "/Users/christina/anaconda3/lib/python3.6/site-packages/jupyterthemes/__init__.py", line 80, in install_theme
dfonts=dfonts)

File "/Users/christina/anaconda3/lib/python3.6/site-packages/jupyterthemes/stylefx.py", line 142, in set_font_properties
monofont, monofpath = stored_font_dicts(monofont)
ValueError: not enough values to unpack (expected 2, got 0)

Most helpful comment

You can use only the fonts that are shipped with jt unless you are willing to patch its source code.

If you have such a determination, you have to find, in stilefx.py, the definition of the function stored_font_dicts and add your custom fonts in the data structure fonts, where the key is the name you use on the command line and the value contains the font name as used in the generated CSS and the subdirectory where the font is stored. CAVEAT I never tried that myself, have a backup...

HTH ፨ g

All 5 comments

You can use only the fonts that are shipped with jt unless you are willing to patch its source code.

If you have such a determination, you have to find, in stilefx.py, the definition of the function stored_font_dicts and add your custom fonts in the data structure fonts, where the key is the name you use on the command line and the value contains the font name as used in the generated CSS and the subdirectory where the font is stored. CAVEAT I never tried that myself, have a backup...

HTH ፨ g

Thanks for the help. 👍🏽

Thanks for the help. 👍🏽

Did it work?

Thanks for the help. 👍🏽

Did it work?

As fair as I remember, it did work.

The answer above works, thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ozkansafak picture ozkansafak  ·  3Comments

baibai25 picture baibai25  ·  8Comments

meowklaski picture meowklaski  ·  9Comments

lucainnocenti picture lucainnocenti  ·  6Comments

mlx809593812 picture mlx809593812  ·  8Comments