chromium: [BUG] System fonts are not loaded
I just migrated:
- From @sparticuz/chrome-aws-lambda (latest available version 17.1.3)
- To @Sparticuz/chromium (latest available 19.8.0 with Chrome 112.0.2).
Before, I was able to install the fonts system-wide in the Dockerfile with apt-get install fonts-roboto fonts-open-sans fonts-liberation, and they were automatically and successfully loaded by Chromium. After the migration, however, the fonts seem not to be loaded.
Is there any identified reason why this is happening or any suggestion on how to fix it?
I’m not using this (nor I was using it) in AWS, but rather in Google Cloud Run, so https://github.com/Sparticuz/chromium/issues/33 does not seem to help.
BTW: Loading with await chromium.font() cannot be used since is not a solution for headers/footers.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 16 (4 by maintainers)
@Peque my team loads fonts as base64 encoded data to get around the header/footer issue:
This has worked for us for years and still works on the latest
@sparticuz/chromiumversionA few minutes
I got webfonts working by adding
chromium.args.concat(['--font-render-hinting=none'])to options.See https://github.com/puppeteer/puppeteer/issues/2410#issuecomment-560573612
@aldenquimby Thanks for sharing your workaround. 😊
It would still be great to be able to load them from the system as with @sparticuz/chrome-aws-lambda (and as with any non-headless browser). This way you can use common fonts like Roboto and Open Sans without having to load multiple individual blobs “by hand” and without having to declare them once for the signature and another once for the actual web content.