Forum Bugs

Java API & msttcorefonts on Linux

kenkc
Hi all,

Been using PrinceXML for a couple of years now, and never needed to ask a question, but I've got something that has me stumped .....

Our company has an application which calls Prince through the Java API to produce PDF documents from HTML. We have encountered an issue on a Linux installation where we are getting errors such as .....
"no glyphs for character U+0020, fallback to '?'"
"no fallback glyph for character U+0020"

The font specified in the CSS is Arial, and msttcorefonts has been installed. I know this because when I try to convert the same html file from the command prompt it all works beautifully!

So my question is, do I need to do something specifically for Java to pick up the msttcorefonts??

Any and all help is greatly appreciated.
mikeday
U+20 is the space character, which should not need any glyphs in the first place, so this implies that something more odd is happening. Is the file HTML or XML/XHTML? When you convert it from the command line does it have a .html extension? Are you calling setHTML(true) from the Java API?
kenkc
Hi Mike,

Thanks for the reply. We use velocity to merge data with a template to create a html document before it is sent to Prince (although it does have the xhtml namespace). We haven't used setHtml(true) in the Java API so I'll try that. The file does have the html extension, and I was setting --input=html from the command line so maybe that is the difference.

I forgot to mention that this works perfectly when deployed to a Windows machine which makes me think it is more an underlying problem with the environment that the code...

Ken.
kenkc
Hi Mike,

I tried your suggestion, but to no avail. It does seem to be looking more and more like a font issue. I added the --debug parameter to the prince batch script and in the logs you can see the following:

When executed from the command line:

Tue Jul 20 13:21:41 2010: debug: font request: Arial, Helvetica, sans-serif
Tue Jul 20 13:21:41 2010: debug: font scan: Arial
Tue Jul 20 13:21:41 2010: debug: font scan: Arial, 4 matches

When executed from the Java API:

Tue Jul 20 13:09:58 2010: debug: font request: Arial, Helvetica, sans-serif
Tue Jul 20 13:09:58 2010: debug: font scan: Arial
Tue Jul 20 13:09:58 2010: debug: font scan: Arial, 0 matches

Any other ideas??
mikeday
Awkward! Looks like the Java process is running with different shared library settings (LD_LIBRARY_PATH) or other environment variables or permissions that are affecting Fontconfig. You can always make it work by adding @font-face rules for the fonts that you want to access and pointing directly to the relevant TTF files, but it would be more convenient to make Fontconfig work properly.
kenkc
Hi Mike,

Just to keep you updated. It seems that a wrong version of the binaries were deployed on the system. The system was running CentOS, and the RHEL4 binaries were installed. On top of that it was 7.0. We installed the 7.1.1 binaries for CentOS and the problem was resolved.

Thanks for your help,

Ken.