-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] System fonts are not loaded #92
Comments
@Peque my team loads fonts as base64 encoded data to get around the header/footer issue: @font-face {
font-weight: 400;
font-family: 'Nunito Sans';
font-style: normal;
src: url('data:application/x-font-woff;charset=utf-8;base64,BASE64_BLOB_HERE') format('woff2');
font-display: swap;
} This has worked for us for years and still works on the latest |
@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. |
I'm not sure. I think the only thing I've done relating to the font()'s function was disable the use of http to fetch the font. If you are installing the fonts before running chromium, I would think they would just work, I've not used gcr though. |
@Sparticuz Should be easy to reproduce locally with Docker/Podman (no need to use GCP). If needed, I could provide a minimal source code to reproduce the issue. 😊 |
My web fonts not working... |
It was my fault. |
@NazmusSayad care to share what was working incorrectly? |
|
I got webfonts working by adding |
@Sparticuz I am eager to try the v122 release when available if it fixes this issue! 🥳 😊 PS: Is there any estimated release date or not yet? |
A few minutes |
Should be live now |
@Sparticuz Thanks! I tried it but unfortunately without success for my use case. I try to create a minimum reproducible case before reporting/reopening. 😊 |
What OS is your dockerfile starting from? Do you know where the fonts are stored? /var/task/.fonts This should be where fonts are coming from, though the only thing I've done since the old days was add in /var/task/fonts. |
@Sparticuz Simplifying things up I managed to load fonts successfully. So I think this issue can be closed! 🚀 😊 I now need to figure out why |
@Sparticuz it looks like this is still an issue for fonts from external URL. |
For those who are still struggling with the font issue, here's my solution :
Some of the code snippet :
|
I just migrated:
Before, I was able to install the fonts system-wide in the
Dockerfile
withapt-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 #33 does not seem to help.
BTW: Loading with
await chromium.font()
cannot be used since is not a solution for headers/footers.The text was updated successfully, but these errors were encountered: