how to install a font in python

Solutions on MaxInterview for how to install a font in python by the best coders in the world

showing results for - "how to install a font in python"
Irene
03 Jan 2020
1# You can simply use this script :
2https://gist.github.com/lpsandaruwan/7661e822db3be37e4b50ec9579db61e0
3# And if you want to install a font programmatically you just need to
4# change the main() function's argument to your font location
5# like :
6	main("myFont.ttf") # give the font to main function
7# and remove the for statement in main function
8# like :
9def main(argv):
10    # for arg in argv: 
11    if argv.endswith('.otf') or argv.endswith('.ttf'):
12        print('Installing ' + argv)
13        install_font(argv)
14# If you want to use multiple fonts you'll need the for loop and
15# you need to give your fonts locations to main function in a list