vladholubiev / serverless-libreoffice

Run LibreOffice in AWS Lambda to create PDFs & convert documents
https://vladholubiev.com/serverless-libreoffice
513 stars 75 forks source link

Is it possible to add custmoized font? #18

Open diy10264 opened 5 years ago

diy10264 commented 5 years ago

When document containes some WordArt or special font, the result seems unapplicable. Some word and font style was lost and layout was changed.

This issues may be caused by LibreOffice. Are there any method to add own font for each convertion task?

vladholubiev commented 5 years ago

Hey @diy10264

I assume it works similar way how you add fonts on Linux system, except some AWS Lambda quirks.

I don't know will it help with LibreOffice, but I've seen people adding fonts to AWS Lambda for headless Chrome: https://gist.github.com/nat-n/c3429d29f2478ccb3de243810bb12956

Let me know if you find a solution that works for you and I'll add it to the README

ncruces commented 5 years ago

Adding fonts files to instdir/share/fonts/truetype is enough.

I've added all fonts from these sources, to good effect: https://packages.ubuntu.com/bionic/ttf-mscorefonts-installer https://gist.github.com/maxwelleite/10774746

EDIT: Actually, this is the better way to get all those font files manually: https://www.linuxquestions.org/questions/mageia-97/inpossibility-to-install-ms-core-fonts-4175603366/#post5694251

These are all the more common Windows fonts, and add about 5 MB (compressed) and 17Mb (uncompressed) to the distribution.

randombluff commented 4 years ago

download fonts into the tmp folder directly, also add file font.conf(base Amazon Linux 1 file you can find here https://github.com/alixaxel/chrome-aws-lambda/issues/37#issuecomment-493646469) and variables

// process.env.FONTCONFIG_PATH = "/tmp/fonts"; // process.env.FONTCONFIG_FILE = "/var/task/fonts/font.conf"

iamkeyur commented 4 years ago

19 Does adding fonts make a difference to formatting?