chrome-aws-lambda icon indicating copy to clipboard operation
chrome-aws-lambda copied to clipboard

Fonts are ignored

Open Binternet opened this issue 3 years ago • 5 comments

I am trying to run a lambda with a custom image (based on public.ecr.aws/lambda/nodejs:14) I've placed fonts/NotoColorEmoji.ttf in my folder yet I still cannot render emojis correctly.

Here's my code:

await chromium.font('/var/task/fonts/NotoColorEmoji.ttf');    
browser = await chromium.puppeteer.launch(browserParams);

And still - no emojis.

Binternet avatar Jan 26 '22 21:01 Binternet

I got the same issue. I've tried the minimal example as well but I don't see any changes in the font.

  • Node 14 on AWS Lambda with chrome-aws-lambda layer.

SimonJang avatar Feb 21 '22 08:02 SimonJang

I did a workaround that fixed it by following https://github.com/alixaxel/chrome-aws-lambda/issues/246 advice.

Basically, I duplicated the fonts.conf file from the aws.tar.br, added

<dir>~/.fonts</dir>

to the dir list and saved it in the main lambda directory (/var/task/). Then you need to add an environment variable FONTCONFIG_PATH: /var/task and it will work with the latest version on node 14.

deepsyx avatar Feb 21 '22 10:02 deepsyx

@deepsyx Thanks for the tip!

SimonJang avatar Feb 22 '22 13:02 SimonJang

I did a workaround that fixed it by following #246 advice.

Basically, I duplicated the fonts.conf file from the aws.tar.br, added

<dir>~/.fonts</dir>

to the dir list and saved it in the main lambda directory (/var/task/). Then you need to add an environment variable FONTCONFIG_PATH: /var/task and it will work with the latest version on node 14.

How do i do it on a dockerfile?

dungeon2567 avatar May 02 '22 16:05 dungeon2567

aws.tar.br

Can you share the changed file?

dungeon2567 avatar May 02 '22 17:05 dungeon2567