2017-04-03 53 views
2

最近我做了一些幻像js的实验,以截取HTML代码的截图,但我得到了物化图标字体的遗憾错误。为什么材质图标在幻影js中渲染?

我已经犯了这样的

<!DOCTYPE html> 
<html lang='en'> 
    <head> 
    <title>Demo</title> 
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'> 
    <link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet'> 
    <style> 
     html { 
      font-family: 'Roboto', sans-serif; 
     } 
    </style> 
    </head> 
    <body> 
     Hello this is using roboto 
     <i class='material-icons'>favorite_border</i> 
    </body> 
</html> 

的Roboto演示HTML是伟大的工作,但材料的图标不工作。下面的图片是结果我得到: enter image description here

,这应该是我得到什么:

enter image description here

我认为,这是因为材料图标使用

-webkit-font-feature-settings: 'liga' 

和phantomjs做不支持它,我是对的吗?字体真棒工作得很好。 任何线索?

我乳宁它在Ubuntu服务器16.04 LTS和幻象JS是2.1.1 感谢您的帮助

回答

2

它看起来像这样已固定在最新的测试版本2.5 phantomjs,请参阅https://github.com/ariya/phantomjs/issues/14885

另一种解决方案是自我托管网络前端。如果你从自己的服务器提供字体,phantomjs在渲染时没有问题。

+0

Thanx今天尝试和工作完美无缺 –

-1

你举的例子就可以了!

<!DOCTYPE html> 
 
<html lang='en'> 
 
    <head> 
 
    <title>Demo</title> 
 
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'> 
 
    <link href='https://fonts.googleapis.com/icon?family=Material+Icons' rel='stylesheet'> 
 
    <style> 
 
     html { 
 
      font-family: 'Roboto', sans-serif; 
 
     } 
 
    </style> 
 
    </head> 
 
    <body> 
 
     Hello this is using roboto 
 
     <i class='material-icons'>favorite_border</i> 
 
    </body> 
 
</html>

+0

我知道html是正确的,但幻像js不渲染心脏 –