bubkoo / html-to-image

✂️ Generates an image from a DOM node using HTML5 canvas and SVG.
MIT License
5.66k stars 524 forks source link

Can anyone provide a code example of how to include a Google Font? #285

Closed joshembling closed 2 years ago

joshembling commented 2 years ago

I'm tearing my hair out over this, I can't figure out how to properly include fonts in the JS object.

htmlToImage .toPng(node, { backgroundColor: "#621934", preferredFontFormat:@font-face { font-family: "Lato"; src: url("https://fonts.googleapis.com/css2?family=Lato:wght@300;400;700&display=swap"); }, })

Can anyone tell me why this is not working?

vivcat[bot] commented 2 years ago

👋 @joshembling

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

vivcat[bot] commented 1 year ago

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.