pythonpython-3.xwindowsimagemagickmoviepy

How do I give moviepy access to custom installed fonts on Windows?


I have been looking through the depths of the internet and still cannot find anything. When I execute

print(TextClip.list("font"))

My custom-installed fonts are not available. After some research, I thought it could be possible that it has to do with ImageMagick not recognizing my installed fonts. When I researched that, most documentation is for Mac/Linux because Windows supposedly allows all applications to use installed fonts, so ImageMagick should just recognize it.

Has anyone run into this issue before?

I exptected

clip = TextClip("text", color='black', font='PKMN RBYGSC Regular',
                   fontsize=32, )

to use my installed font "PKMN RBYGSC Regular". I have tried all iterations of the name, such as: 'PKMN-RBYGSC-Regular', 'PKMN_RBYGSC_Regular', r'C:\Windows\Fonts\PKMN_RBYGSC.ttf', etc.

The result was moviepy using the default font. I read that this has to do with ImageMagick


Solution

  • Yes, you are right. You have to do this with ImageMagicK. On windows, go to ImageMagicK installation folder and find the type-ghostscript.xml file.

    Simply add the custom font in the tag. For example, if you want to add Poppins font then you have to use

    <type name="Poppins" fullname="Poppins" family="Poppins" style="normal" weight="400" stretch="normal" format="type1" metrics="C:\Users\Downloads\Poppins\Poppins-Regular.ttf" glyphs="C:\Users\Downloads\Poppins\Poppins-Regular.ttf" />
    

    Save this file as administrator.

    Then, do this

    clip = TextClip("text", color='black', font='Poppins',
                       fontsize=32)