Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: Fonts look garbled on Linux, but fine on windows

I'm writing a java application that renders PDF documents to images, and when I run it on windows it works fine. But when I render the PDF on Linux, the standard fonts look a bit garbled, like there would be a few pixels missing on the right side of some characters.

I only tested it on a fresh install of Ubuntu 9.04 with OpenJDK 6, but I'm quite sure I have seen similar issues before on Linux. I also tried to open the PDF with other Java PDF applications, like the SwingLabs PDFRenderer and the IcePDF Demo Applet, and they had the same problem. On windows they all render the document just fine. I also opened the document on the same Ubuntu machine with the default PDF viewer, evince. Evince rendered the document without the font issue, so I'm quite sure this is a general Java + Linux problem.

For comparison:
This image was rendered on Windows.
This image was rendered on Linux. I marked a few garbled characters with red rings.
This one was also rendered on Linux. It looks like only standard fonts are affected.

Any help is appreciated.

like image 817
mooware Avatar asked Dec 10 '22 19:12

mooware


1 Answers

OpenJDK has to put out fonts which are copyright protected. Install Sun's Java and fonts will be somehwat better.

like image 190
ante.sabo Avatar answered Dec 27 '22 10:12

ante.sabo