Web Fonts do not render, use fallback fonts instead.
[email protected] commented:
Which version of PhantomJS are you using? Tip: run 'phantomjs --version'.
1.5.1 (development)
What steps will reproduce the problem?
- Using rasterize.js generate a png of https://developers.google.com/webfonts/
- 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.
[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
[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.
[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.
[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.
[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?
[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.
[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
[email protected] commented:
That's all? You just need to have those packages installed when compiling and running?
[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?
[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.
[email protected] commented:
Instructions:
- Checkout PhantomJS 1.7 version as described in the official instruction: http://phantomjs.org/build.html
- Add the remote repo which contains the needed branch: git remote add vital https://github.com/Vitallium/phantomjs.git git fetch vital
- Switch to the branch with WOFF file support: git checkout -b Enable-WOFF-format-support vital/Enable-WOFF-format-support
- Compile PhantomJS as usual
[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/
[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
[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.).