当我使用
phantomjs
将 HTML 页面转换为图像 (png) 时,图片上的字体系列未呈现。字体系列是 Arial。我的平台是Linux(Ubuntu)。我的 Linux 在 /usr/share/fonts/truetype/
和 /usr/share/fonts/type1
中有 Arial。
问这个问题已经有一段时间了,但我遇到了同样的问题。即,当尝试通过 PhantomJS 截取屏幕截图时,Arial 无法正确渲染。
我在这里找到了解决方案:
https://askubuntu.com/questions/651441/how-to-install-arial-font-and-other-windows-fonts-in-ubuntu
为了简单起见,我会重复一遍,但是,它是barsmaga的工作:
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections
apt-get install -y ttf-mscorefonts-installer
如果这不起作用,请尝试使用
--reinstall
:apt-get install -y ttf-mscorefonts-installer --reinstall
我的记录规格:
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS
作为一些扩展上下文:
我试图用
huxtable
中的 webshot
来截取 R statistics
html 表格的屏幕截图。