Phantomjs font issue issue

Using the latest version of phantomjs v1.9.7, there is a problem with displaying some characters on my production server. No problem on dev server.

When rendering the phantomjs.org main page, fonts with a strong tag or some bold type, such as 700em, display correctly, but the normal font is not.

I have not noticed this problem with other urls yet.

Also, all Chinese characters from any URL (which I have checked so far) display with fields on the production server, but correctly on the dev server.

I do not know what the problem is.

Here is a screenshot of the http://phantomjs.org section for each server:

production server - debian 7 stable phantomjs.com - production server - debian 7 stable

dev server - debian 8 testing phantomjs.com - dev server - debian 8 testing


http://taoboa.com

production - debian 7 stable

taobao.com - production server -debian 7 stable

dev - debian 8

taobao.com - dev server - debian 8 testing

? .

+3
3

, , - Debian 7 Ubuntu 13.10, . , - , fontconfig libfreetype6... .

+2
0

, , .., :

  • .ttf Unicode fonts. , Unicode .

  • .ttf / /etc/fonts, ~/.fonts. unix, , , , root (, )

  • fc-cache -fv /etc/fonts, fc-cache -fv ~/.fonts/ . fc-cache

phantomjs utf-8

var HTMLfile = fs.open(path + file_name, {
    mode: 'r', //read
    charset: 'utf-8' 
});
var content = HTMLfile.read();
HTMLfile.close();

-

var webPage = require('webpage');
var page = webPage.create();
var settings = {
  operation: "POST",
  encoding: "utf8",
  headers: {
    "Content-Type": "application/json"
  },
  data: JSON.stringify({
    some: "data",
    another: ["custom", "data"]
  })
};

After a long search, this worked for me.

0
source

All Articles