1

I'm trying to install a font on AWS Lambda to use TextClip() function of moviepy. I followed step by step this answer https://stackoverflow.com/a/51622335/6673340, but the font still doesn't want to instal...

I have the following files and dir in my deployement package :

enter image description here

This is my fonts.conf :

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/opt/fonts/</dir>
  <cachedir>/tmp/fonts-cache/</cachedir>
  <config></config>
</fontconfig>

And I also add : FONTCONFIG_PATH=/opt/fonts

But I still get the following error :

[ERROR] OSError: MoviePy Error: creation of None failed because of the following error:

convert: unable to read font `Rubik-Regular' @ warning/annotate.c/RenderType/955.
convert: delegate library support not built-in 'Rubik-Regular' (Freetype) @ warning/annotate.c/RenderFreetype/1808.
convert: no images defined `PNG32:/tmp/tmp3h8xrg3n.png' @ error/convert.c/ConvertImageCommand/3300

Do either of you know why this isn't working for me?

flmd
  • 71
  • 1
  • 8

1 Answers1

0
/var/task is the directory where you codebase lives as per lambda convention 

so as per your current structure i think FONTCONFIG_PATH=/var/task/fonts

and font.conf should be 

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/var/task/fonts/</dir>
  <cachedir>/tmp/fonts-cache/</cachedir>
  <config></config>
</fontconfig>