mpl_setup_fonts.py 420 B

123456789101112131415
  1. # -*- coding: utf-8 -*-
  2. # this is a quick script to ensure that matplotlib can use the fonts
  3. import importlib.util
  4. from pathlib import Path
  5. import shutil
  6. import glob
  7. mpl_spec = importlib.util.find_spec("matplotlib")
  8. mpl_loc = Path(mpl_spec.origin).parent.resolve()
  9. mpl_fonts_loc = Path.joinpath(mpl_loc, 'mpl-data', 'fonts', 'ttf')
  10. ttf_files = glob.glob('*.ttf')
  11. for f in ttf_files:
  12. shutil.copy(f, mpl_fonts_loc)