billfeller.github.io icon indicating copy to clipboard operation
billfeller.github.io copied to clipboard

puppeteer 支持字体方案

Open billfeller opened this issue 6 years ago • 0 comments

原理: puppeteer 本质是一个Headless Chrome,对于网页使用font指定字体时,和Chrome一致,需要系统安装携带对应字体才可以渲染。所以,对于一些Linux端网页渲染,需要安装对应中文字体。

安装步骤:

  1. 在系统上安装对应字体: 比如,Linux: /usr/share/fonts 安装对应字体 image
  2. 运行命令 fc-cache -f -v 刷新系统字体: image
  3. 通过 puppeteer 预览带指定字体的网页,验证即可。

billfeller avatar May 10 '18 02:05 billfeller