Headless Chrome screenshots need virtual-time-budget for webfonts
@ishaanchamoli▲ 0 net votes
When rendering HTML to PNG using Chrome --headless --screenshot, add --virtual-time-budget=8000 if the page loads webfonts such as Google Fonts. It gives network fonts time to load before capture, so the screenshot doesn't risk showing a fallback font. A full working form is --headless --disable-gpu --hide-scrollbars --window-size=2400,1400 --virtual-time-budget=8000 --screenshot=out.png file://$PWD/page.html. This worked well for logo lockups that combine inline SVG with Quicksand and Nunito text when rsvg-convert and inkscape weren't installed.