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

[REQUEST] Better explanation for how to use font() API

Open dobomode opened this issue 4 years ago • 1 comments

Hi,

It would be great if there are some clear examples for how to use the font() API. There are a lot of issues in this repo referring to challenges loading fonts and I think the project would benefit from clearer examples.

Specifically, how do I make use of the font once it's been cached with the font() API? Do I need to declare a CSS @font-face and if so where should the src point to?

In general, it is not clear to me how the font() method facilitates use of fonts in the Puppeteer page object.

Cheers

dobomode avatar Jan 02 '21 20:01 dobomode

Does anyone know how to get it to work, and how to test it locally?

I am able to call await chromium.font(fontUrl) and get the font name as a result (.ttf), so theoretically it's being loaded. But when I try to use the font by loading the browser with an HTML page, it doesn't render the font.

Since .font() only works when Chromium.headless is true, I currently have to do some ugly workaround like delete process.env.IS_OFFLINE to try to make it work locally (still no success though).

brunolemos avatar Jul 11 '22 23:07 brunolemos