Arial cross platform solution

In my Swing application, I am using the Arial font. Unfortunately, this is done differently on different platforms:

Windows:

Windows variant

Mac OS X:

enter image description here

Linux:

enter image description here

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!

+3


source to share


4 answers


One solution is to download the font file using Font.createFont()

. Here's an example .



+2


source


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.



+5


source


Have you tried anti-aliasing like in this article http://docs.oracle.com/javase/tutorial/2d/text/renderinghints.html

0


source


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

0


source







All Articles