Puppeteer doesn't render default fonts
See original GitHub issueHello,
I was trying to generate jpg or pdf, but is fails on fonts. I’ve made this example URL: https://www.myfeesy.com/foo.html with this code example:
<html>
<body>
FOOOO <span style="font-family: Impact, Charcoal">impact</span>
<span style="font-family: 'Courier New', Courier, monospace">courier</span>
</body>
</html>
Local render (OS X) works like a charm, everything is great:

But when I follow this readme: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker (or any other, believe me, spend with that more hours than I want), the result is as following, fonts are weird (both courier and impact, even for PDF, doesn’t matter):

Dockerfile is exactly the same as in the example, puppeteer.js is:
'use strict';
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://www.myfeesy.com/foo.html');
await page.screenshot({path: '/home/pptruser/Downloads/example.png'});
await page.pdf({
path: '/home/pptruser/Downloads/example.pdf',
format: 'A4'
});
await browser.close();
})();
and generate by:
docker run -i -d --cap-add=SYS_ADMIN \
--name puppeteer-chrome feesy-render \
node -e "`cat puppeteer.js`"
Then just docker cp puppeteer-chrome:/home/pptruser/Downloads ./foo to copy and take a look.
It looks like it doesn’t render fonts right, but only when in Docker container.
Does anybody know when the problem can be?
Thank you very much.
Jakub
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:7 (2 by maintainers)
Top Related StackOverflow Question
CentOS 7 & Puppeteer
@KromDaniel, for a proper letter-spacing try ‘–font-render-hinting=none’ or ‘–font-render-hinting=medium’