Arial cross platform solution
In my Swing application, I am using the Arial font. Unfortunately, this is done differently on different platforms:
Windows:
Mac OS X:
Linux:
The Windows and Mac OS X variants look pretty much the same. Linux is completely different and doesn't seem to be Arial at all. The main problem is the different width of the letters ...
What would be the best solution to make the text look like the Windows on Linux variant? Probably some alternative fonts like Nimbus Sans L?
Some limitations: JRE cannot be shipped with the application and it must be very close to Arial.
Thank!
One solution is to download the font file using Font.createFont()
. Here's an example .
Variety of Embrace platform. Given that different platforms have the same fonts with different metrics, let each component do the work of figuring out its own preferred size without getting in the way and using layouts correctly. Here's a good example with screenshots.
Have you tried anti-aliasing like in this article http://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html
You can install free Microsoft fonts on Linux and use them in Java. This includes the Arial font. This blog post shows you how: How to install Windows fonts in Java on Linux