Only Courier-Fonts with Phantomjs 1.7/1.8/1.9, per

2020-07-24 04:34发布

问题:

Since updating to OpenSuse 12.2 I cannot use phantomjs (updated from 1.5 to Version 1.8.1 64bit) any longer to create screenshots. The problem is a missing font support for serif/sansserif fonts. Only a courier/monospace like font is used.

Additionally phantomjs is really slow on rendering (5 seconds and more --> solved).

I tried to install packages like google-droid-fonts, free-ttf-fonts, bitstream-vera-fonts, freetype, font-config - but the only result are some other ugly fonts used.

Does anybody knows how to configure OpenSuse 12.2 to enable some useable fonts (like googles droid fonts) as fallback in phantomjs? Or did I miss to install a important font-render-lib (slow rendering)?

Update

  • Building from source solved the performance issue
  • Installing the Microsoft Core fonts like "Arial" etc did not help
  • "fc-match" returns the right results
  • an "strace -e open" shows, that phantomjs access the configs under /etc/fonts alright

Update 2

  • The problem seems to originate in the CSS of my project. Trying different sites, most are well rendered.
  • Tested version PhantomJS 1.9 with the same results
  • Public URL to reproduce the bug: http://www.berlin.de/kennedy/

回答1:

I had a similar problem, installing the urw-fonts package solved it for me.

In my case no fonts where rendering at all, so this might not be the solution in your case, but worth a try:

yum install urw-fonts



回答2:

The problem was solved by some major CSS rewrites including an update of Twitter Bootstrap. In some way some CSS rules interfered with the correct rendering.

With newer OS versions, I cannot reproduce the bug, either.



标签: phantomjs