Phantomjs: Some regular fonts change to italic on capture

Created on 7 Sep 2015  路  6Comments  路  Source: ariya/phantomjs

I use phantom to capture site with many custom fonts (some google fonts, some local)
For unknown reason some of the fonts become italic on capture
Changing the CSS font-face didn't change anything.
Example of pages with problematic fonts:
https://www.google.com/fonts/specimen/Amatic+SC
https://www.google.com/fonts/specimen/Rozha+One

phantomjs ver: 2.0 platform: windows

JS code used:
/*
var page = require('webpage').create();
page.viewportSize = { width: 320, height: 480 };
page.open('https://www.google.com/fonts/specimen/Amatic+SC', function (status) {
if (status !== 'success') {
console.log('Unable to access the network!');
} else {
page.evaluate(function () {
});
page.render('technews.png');
}
phantom.exit();
});
*/
capture

Bug Windows

Most helpful comment

Stumbled across this bug too, a workaround is to disable certain font formats (.ttf, .otf), ex:

@font-face {
  font-family: 'CustomFont-Medium';
  src: url('CustomFont-Medium.eot');
  src: url('CustomFont-Medium.woff2') format('woff2'),
       url('CustomFont-Medium.woff') format('woff'),
       /*url('CustomFont-Medium.ttf') format('truetype'),*/
       url('CustomFont-Medium.svg#CustomFont-Medium') format('svg'),
       url('CustomFont-Medium.eot?#iefix') format('embedded-opentype');
  font-weight: normal;
  font-style: normal;
}

All 6 comments

I also noticed this with Material design iconic font. (http://zavoloklom.github.io/material-design-iconic-font/icons.html)
pjs_bug

Left image is from Chrome and right is rendered with PhantomJS 2.0.0.

There is no italic font problem if I render the page with the previous version of PhantomJS.

We apologize for not responding to this bug report sooner.

I cannot reproduce the problem using PhantomJS 2.0 on Linux (I tried both of the Google Fonts pages). This suggests a Windows-specific issue. It is probably deep in the guts of WebKit.

Unfortunately, we do not have the manpower to debug WebKit issues ourselves. Please report this directly to the WebKit development team: https://www.webkit.org/quality/reporting.html

Problem still persists :/

Stumbled across this bug too, a workaround is to disable certain font formats (.ttf, .otf), ex:

@font-face {
  font-family: 'CustomFont-Medium';
  src: url('CustomFont-Medium.eot');
  src: url('CustomFont-Medium.woff2') format('woff2'),
       url('CustomFont-Medium.woff') format('woff'),
       /*url('CustomFont-Medium.ttf') format('truetype'),*/
       url('CustomFont-Medium.svg#CustomFont-Medium') format('svg'),
       url('CustomFont-Medium.eot?#iefix') format('embedded-opentype');
  font-weight: normal;
  font-style: normal;
}

Thanks @luffs ! I looked for this bug for a while and your solution fixed it!

Issue still persists
source
capture

Was this page helpful?
0 / 5 - 0 ratings