how to install a font in python code example

Example: how to install a font in python

# You can simply use this script :
https://gist.github.com/lpsandaruwan/7661e822db3be37e4b50ec9579db61e0
# And if you want to install a font programmatically you just need to
# change the main() function's argument to your font location
# like :
	main("myFont.ttf") # give the font to main function
# and remove the for statement in main function
# like :
def main(argv):
    # for arg in argv: 
    if argv.endswith('.otf') or argv.endswith('.ttf'):
        print('Installing ' + argv)
        install_font(argv)
# If you want to use multiple fonts you'll need the for loop and
# you need to give your fonts locations to main function in a list

Tags:

Misc Example