phantomjs icon indicating copy to clipboard operation
phantomjs copied to clipboard

Web Fonts do not render, use fallback fonts instead.

Open atheken opened this issue 14 years ago • 100 comments

[email protected] commented:

Which version of PhantomJS are you using? Tip: run 'phantomjs --version'.

1.5.1 (development)

What steps will reproduce the problem?

  1. Using rasterize.js generate a png of https://developers.google.com/webfonts/
  2. You should see stylized text for some of the web fonts.

What is the expected output? What do you see instead?

--see actual/expected images. Web fonts use their fallbacks instead of the "real" fonts.

Which operating system are you using?

Windows 2008 R2

Did you use binary PhantomJS or did you compile it from source?

no, downloaded the (1.5.0 static package from the project website)

Please provide any additional information below.

Disclaimer: This issue was migrated on 2013-03-15 from the project's former issue tracker on Google Code, Issue #592. :star2:   30 people had starred this issue at the time of migration.

atheken avatar Jun 15 '12 01:06 atheken

[email protected] commented:

I just retested this:

This issue appears to be specific to .woff files. I just tried (one) .ttf file (encoded as a data-uri), and the font render perfectly (the font I used is here: http://www.w3schools.com/css3/Sansation_Light.ttf)

I would also note that when I retested this, I had updated to 1.6.0, so it might have been fixed since 1.5.1

atheken avatar Jun 30 '12 05:06 atheken

[email protected] commented:

Did you mangage to get phantom.js working with google font? Cause I got the exact same issue with Typekit.com and Google Webfonts using phantom.js vers 1.6.1.

plehoux avatar Aug 09 '12 03:08 plehoux

[email protected] commented:

Nope, still an issue in 1.6.1

atheken avatar Aug 09 '12 03:08 atheken

[email protected] commented:

Is there progress on this issue?

ariya avatar Oct 23 '12 10:10 ariya

[email protected] commented:

Nils, if there is no update posted to this issue, it means there is no progress. Your question has an obvious answer.

ariya avatar Oct 24 '12 13:10 ariya

[email protected] commented:

I have a fix for this issue. But, it will bring new dependency to the current WebKit source tree - zlib (WOFF files are required it). The Qt source tree already has it.

If you interesting, let me know.

In the latest WebKit trunk WOFF files support is disabled by default.

vitallium avatar Nov 17 '12 02:11 vitallium

[email protected] commented:

[email protected], Can you please provide instructions on how to add support for WOFF files? I really need. I assume phantomjs needs to be compiled from source?

dmitrykh avatar Dec 04 '12 01:12 dmitrykh

[email protected] commented:

I would also be interested in instructions on how to enable WOFF support in 1.7. I'm already using a custom build version (to re-enable flash) so that would be no problem.

erikdubbelboer avatar Dec 04 '12 02:12 erikdubbelboer

[email protected] commented:

Just resolved it. make sure you have all these installed: [root@phoenix api]# rpm -qa | grep font fontconfig-2.8.0-3.el6.x86_64 libfontenc-1.0.5-2.el6.x86_64 fontconfig-devel-2.8.0-3.el6.x86_64 libXfont-1.4.1-2.el6_1.x86_64 ghostscript-fonts-5.50-23.1.el6.noarch xorg-x11-font-utils-7.2-11.el6.x86_64 urw-fonts-2.4-10.el6.noarch

dmitrykh avatar Dec 04 '12 03:12 dmitrykh

[email protected] commented:

Did you still need instructions? :)

vitallium avatar Dec 04 '12 04:12 vitallium

[email protected] commented:

That's all? You just need to have those packages installed when compiling and running?

erikdubbelboer avatar Dec 04 '12 04:12 erikdubbelboer

[email protected] commented:

I'm facing the same problem on my EC2 server with Ubuntu 12.04.1 LTS with a custom built phantomjs 1.7.1 - .woff fonts are not working.

I'm wondering now which packages i have to install on ubuntu to achiev this - but i tried to work through the list of these said packages, but i was not able to find all for ubuntu... and beside these package-installations - how can we activate the .woff support in phantomjs 1.7?

rvetere avatar Dec 04 '12 15:12 rvetere

[email protected] commented:

There is the only way to enable .woff file support in PhantomJS - you will need to apply one patch and compile PhantomJS from source code. I'll write instruction later.

vitallium avatar Dec 04 '12 15:12 vitallium

[email protected] commented:

Instructions:

  1. Checkout PhantomJS 1.7 version as described in the official instruction: http://phantomjs.org/build.html
  2. Add the remote repo which contains the needed branch: git remote add vital https://github.com/Vitallium/phantomjs.git git fetch vital
  3. Switch to the branch with WOFF file support: git checkout -b Enable-WOFF-format-support vital/Enable-WOFF-format-support
  4. Compile PhantomJS as usual

vitallium avatar Dec 05 '12 06:12 vitallium

[email protected] commented:

not working after this long build...

ariya avatar Dec 05 '12 21:12 ariya

[email protected] commented:

Could you provide me a link?

vitallium avatar Dec 05 '12 21:12 vitallium

[email protected] commented:

I built the WOFF-enabled branch on OS X 1.8.2 just now.

Fonts render as expected.

I think it's important to make sure that you try to rasterize a page that is NOT lazily loading fonts after DOM Load:

For example, this will not render the fonts with rasterize.js: http://www.google.com/webfonts

However, this url will render the font (since the web font appears to be loaded before DOM Load): https://developers.google.com/webfonts/

atheken avatar Dec 05 '12 22:12 atheken

[email protected] commented:

Here is a test with 'Open Sans' font: This is the original page: http://www.google.com/webfonts/specimen/Open+Sans This is the capture http://dobrx2zp5pxii.cloudfront.net/captures/gtGWb3qdola3ARJDWR2i.jpg

ariya avatar Dec 05 '12 23:12 ariya

[email protected] commented:

Please read my previous comment, use rasterize.js with the second link I referenced.

It is not clear whether the issue is with the font, or the way it is being loaded, if you follow my instructions from my previous comment, we can confirm whether your build is broken (rather than vagaries with the font or the event firing, etc.).

atheken avatar Dec 05 '12 23:12 atheken

[email protected] commented:

Oh, thanks! It's reproducible only on Linux. I'll see what can I do.

vitallium avatar Dec 05 '12 23:12 vitallium