Skip to content
This repository has been archived by the owner. It is now read-only.

Linux: Text is rendered as box (or square) #10460

Closed
ariya opened this issue Mar 26, 2012 · 22 comments

Comments

Projects
None yet
8 participants
@ariya
Copy link
Owner

commented Mar 26, 2012

diwu1...@gmail.com commented:

Which version of PhantomJS are you using? Tip: run 'phantomjs --version'.
Version 1.5.0 running on Ubuntu server 10.04 headless

What steps will reproduce the problem?

  1. Run phantomjs with the rasterize.js sample script on Techcrunch.com

What is the expected output? What do you see instead?
See a PNG of techcrunch.com with visible characters, but I get the attached image instead.

Which operating system are you using?
Ubuntu 10.04

Did you use binary PhantomJS or did you compile it from source?
Compiled from source because Ubuntu package only exists for 10.10

Please provide any additional information below.
I tried this on other websites such as Wikipedia, Google, etc.. and they all work fine. I have the common fonts installed on the server, but I still suspect that perhaps this could be a font or charset issue.

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

@ariya

This comment has been minimized.

Copy link
Owner Author

commented Mar 27, 2012

ariya.hi...@gmail.com commented:

Reported on the mailing-list as well: https://groups.google.com/forum/#!topic/phantomjs/LBYIyBNGdkA/discussion.

 
Metadata Updates

  • Label(s) removed:
    • Priority-Medium
  • Label(s) added:
    • Priority-High
    • Component-Logic
    • Domain-Qt
  • Milestone updated: FutureRelease (was: ---)
@ariya

This comment has been minimized.

Copy link
Owner Author

commented Mar 27, 2012

ariya.hi...@gmail.com commented:

Issue 464 has been merged into this issue.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented Mar 27, 2012

ariya.hi...@gmail.com commented:

Make the title more generic, it's not only TechCrunch.

 
Metadata Updates

  • Status updated: Accepted
  • Title updated: Linux: Text is rendered as box (or square)
@donjuanica

This comment has been minimized.

Copy link

commented Apr 8, 2012

donjuan...@gmail.com commented:

I'm seeing the same thing when running phantomJS on Amazon EC2. Tried with Amazon AMI and Ubuntu AMI. Problem exists in version 1.5.0 and 1.5.1. I tried the binary builds and I tried compiling from source.

Pertinent info posted here: https://gist.github.com/2332257

Version 1.5.0 works fine on my OSX machine.

@andreycizov

This comment has been minimized.

Copy link

commented Apr 12, 2012

aci...@gmail.com commented:

Had the same problem because I was trying to use x86 phantomjs on on a x86_64, so I guess it was because it could not load the needed libraries to render the fonts.

Is there any case developers could add a warning saying it cannot load the lib?

@aportale

This comment has been minimized.

Copy link
Contributor

commented Apr 14, 2012

alessandro.portale@gmail.com commented:

I can reproduce the issue with techcrunch.com (Ubuntu 11.10 32-bit, downloaded Dynamic PhantomJS binary).

...building PhantomJS in order to debug...

@aportale

This comment has been minimized.

Copy link
Contributor

commented Apr 14, 2012

alessandro.portale@gmail.com commented:

I defined FONT_MATCH_DEBUG in qfontdatabase.cpp and got the attached output (when calling examples/rasteraze.js with aol.com).

Too tired right now to properly identify the issue. But so far it is noticable that the QFontEngineBox is returned quite often by the font database. This should afaik only happen as the very last fallback, if not fonts are available to Qt at all. And QFontEngineBox does just one thing, but it does it well: It draws boxes.

Techcrunch.com and Aol.com seem to use web fonts (e.g. "BebasNeue-webfont.ttf") which Qt loads as application fonts. Something may be going wrong there.

@aportale

This comment has been minimized.

Copy link
Contributor

commented Apr 15, 2012

alessandro.portale@gmail.com commented:

I attached "issue_460.html", a minimal test case that reproduces the issue. It seems indeed that -on some Linuxes- the font system in the QPA plugin does not support application fonts (thus webfonts/@font-face). Loading an application font does actually even break everything in such a way that the blocks even appear for text that would use a default font.

Hard to say what exactly goes wrong. We would need to understand what the difference between QPA used by PhantomJS and the formerly used X11 backend is.

@flobby

This comment has been minimized.

Copy link

commented Apr 21, 2012

florian....@flobbymedia.de commented:

Hi, any updates on this? We are using this on ubuntu and the same problem... Any Information that could help you?

@xcolour

This comment has been minimized.

Copy link

commented Apr 26, 2012

m...@datadoghq.com commented:

I can reproduce this issue, and it seems isolated to TrueType @font-face declarations. If I remove my ttf @font-face definitions and leave woff, svg, and eot, everything works as expected.

@xcolour

This comment has been minimized.

Copy link

commented Apr 26, 2012

m...@datadoghq.com commented:

What I've done to work around this bug (and I'm in the fortunate position of controlling the page I want to rasterize) is create a special override stylesheet that re-defines my @font-face styles to remove the ttf versions of the fonts. The override is triggered by a special query parameter that I only invoke when opening a page with phantom.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented Apr 27, 2012

diwu1...@gmail.com commented:

Perhaps we can just inject JS into the page being rendered to strip the @font-face ttf style?

I'm not sure how to do this through Javascript, does anyone know how?

@milianw

This comment has been minimized.

Copy link
Contributor

commented May 3, 2012

m...@milianw.de commented:

I found (and fixed) the issue:

#245

I'll also send this patch to Qt upstream.

Cheers

@ariya

This comment has been minimized.

Copy link
Owner Author

commented May 4, 2012

ariya.hi...@gmail.com commented:

Excellent finding! The pull request has been processed and also backported to 1.5 branch, thank you so much!

@donjuanica

This comment has been minimized.

Copy link

commented May 4, 2012

donjuan...@gmail.com commented:

Thanks for your work Milian. Recompiling now.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented May 4, 2012

ankitjai...@gmail.com commented:

Thanks for the fix Milian! Would surely benefit a lot of people.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented May 4, 2012

diwu1...@gmail.com commented:

Thanks!!! :)

@milianw

This comment has been minimized.

Copy link
Contributor

commented May 4, 2012

m...@milianw.de commented:

Ariya: thanks for merging, you can close this issue now, no?

@ariya

This comment has been minimized.

Copy link
Owner Author

commented May 5, 2012

ariya.hi...@gmail.com commented:

Closing.

 
Metadata Updates

  • Milestone updated: Release1.6 (was: FutureRelease)
  • Status updated: Fixed

@ariya ariya closed this May 5, 2012

@ananelson

This comment has been minimized.

Copy link

commented Jun 11, 2012

nelson....@gmail.com commented:

What is the timeline for getting a pre-compiled release with this fix in it? The 1.5.0 builds available for download still seem to have the bug.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented Jun 19, 2012

ariya.hi...@gmail.com commented:

Issue 606 has been merged into this issue.

@ariya

This comment has been minimized.

Copy link
Owner Author

commented Dec 15, 2012

precisio...@gmail.com commented:

It's worth noting that after fighting with this problem for several hours, it occurred to me that a headless server by default has NO fonts installed...

So I copied /usr/share/fonts/ from another server then ran "fc-cache -v /usr/share/fonts/" to load them...

Works great now!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.