79428695

Date: 2025-02-11 01:53:42
Score: 0.5
Natty:
Report link

The easier ways is probably to use FindSystemFontsFilename:

import os
import shutil
from pathlib import Path
from find_system_fonts_filename import install_font

filename_src = Path("PATH_TO_THE_FONT_TO_INSTALL.TTF")

# find_system_fonts_filename only support installing users fonts (see https://stackoverflow.com/a/77661799/15835974)
filename_dst = Path(os.environ["USERPROFILE"], "AppData", "Local", "Microsoft", "Windows", "Fonts", filename_src.name)

shutil.copyfile(filename_src, filename_dst)
install_font(filename_dst, True)

You can find FindSystemFontsFilename here.

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jeremie bergeron