phantomjs 无法渲染 font-family

问题描述 投票:0回答:2

当我使用

phantomjs
将 HTML 页面转换为图像 (png) 时,图片上的字体系列未呈现。字体系列是 Arial。我的平台是Linux(Ubuntu)。我的 Linux 在
/usr/share/fonts/truetype/
/usr/share/fonts/type1
中有 Arial。

linux ubuntu fonts phantomjs
2个回答
0
投票

0
投票

问这个问题已经有一段时间了,但我遇到了同样的问题。即,当尝试通过 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 表格的屏幕截图。

© www.soinside.com 2019 - 2024. All rights reserved.