alixaxel / chrome-aws-lambda

Chromium Binary for AWS Lambda and Google Cloud Functions
MIT License
3.2k stars 292 forks source link

Fonts are ignored #257

Open Binternet opened 2 years ago

Binternet commented 2 years ago

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.

SimonJang commented 2 years ago

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

deepsyx commented 2 years ago

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.

SimonJang commented 2 years ago

@deepsyx Thanks for the tip!

dungeon2567 commented 2 years ago

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 commented 2 years ago

aws.tar.br

Can you share the changed file?