# Java Fonts and Linux

**URL:** <https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112>\
**Category:** Archived Topics\
**Created:** [April 27, 2009, 4:27pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112 "2009-04-27T16:27:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [April 27, 2009, 4:27pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/1 "2009-04-27T16:27:01Z")

</div>

In Ubuntu anyways, the Dialog logical font maps to LucidaSans, whereas in Windows, it maps to Arial. The result of this is you text wont always look proper, or in my case, fit in the specified text box. To fix this, you need to install the Arial font

```auto
sudo apt-get install msttcorefonts
```

and change the font mapping by

```auto
sudo nano /usr/lib/jvm/java-6-sun/jre/lib/fontconfig.properties
```

and change lucidasans to arial in all the dialog mappings.

Other versions of Linux can be fixed the same way, although they might use a different package manager, or might need the fonts to be installed manually.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [April 27, 2009, 4:54pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/2 "2009-04-27T16:54:50Z")

</div>

Kyle - thanks for posting this, very handy.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [April 27, 2009, 9:04pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/3 "2009-04-27T21:04:00Z")

</div>

That’s great Kyle - a big improvement. I’ve tried my current app. in Ubuntu 9.04 and it looks just the same as when running in Windows.

Al

---

<div class="post-metadata">

**Author:** ![porksmash](https://avatars.discourse-cdn.com/v4/letter/p/848f3c/32.png) [@porksmash](https://forum.inductiveautomation.com/u/porksmash)\
**Post date:** [May 11, 2009, 6:29pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/4 "2009-05-11T18:29:39Z")

</div>

Supposedly you aren’t supposed to use these fonts unless you own some copy of Windows. Not a problem for most people, but I can see a business being careful about things like that. Then again, it is hard to find a business that doesn’t have at least one Windows PC somewhere.

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [April 30, 2010, 9:31am UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/5 "2010-04-30T09:31:21Z")

</div>

Any idea how to change the fonts used by OpenJDK Java 6? This is the version of Java most easily installed when using Ubuntu 10.04.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [October 26, 2010, 1:51pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/6 "2010-10-26T13:51:50Z")

</div>

Ubuntu 10.04+ Font Configuration

The setup has change in 10.04+.

First, you still need to install the Arial font.

```auto
sudo aptitude install msttcorefonts
```

Secondly, there are specific mapping files installed for Ubuntu, But I just delete them and deal directly with the fontconfig.properties file.

```auto
sudo rm /usr/lib/jvm/java-6-sun/jre/lib/fontconfig.Ubuntu.*
```

Then replace /etc/java-6-sun/fontconfig.properties with the attached file.  
[fontconfig.properties](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/57d20803e56d09a7ba049c1924065cbc0444d619.properties) (17.6 KB)

---

<div class="post-metadata">

**Author:** ![AlThePal](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/althepal/32/3603_2.png) [@AlThePal](https://forum.inductiveautomation.com/u/AlThePal)\
**Post date:** [October 26, 2010, 10:01pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/7 "2010-10-26T22:01:33Z")

</div>

Thanks for that Kyle, that helped me get it working.

I found a good explanation of how Java maps logical fonts to physical fonts using font configuration files [here](http://download.oracle.com/javase/6/docs/technotes/guides/intl/fontconfig.html). This explained that the fontconfig.Ubuntu.bfc file was taking precedence over the fontconfig.properties file. When you delete the Ubuntu version of the file the system then defaults to using fontconfig.properties.

I noticed that your version of fontconfig.properties has an xlfd name for dialog.plain.latin-1 of`dialog.plain.latin-1=-b&h-arial-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
`I found a tool called xfontsel which lets you create these names - this shows that Arial comes under monotype. As far as I can see you also have to have an entry in the Font File Names section for each flavour of Arial i.e. normal, bold, italic and bold italic. I’ve attached an updated fontconfig.properties file which includes these changes.  
[fontconfig.properties](https://us1.discourse-cdn.com/inductiveautomation/original/2X/3/300c2e27a66adc51f3f9c4aa7a99d9cdf75fcf03.properties) (18.0 KB)

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [September 2, 2011, 7:48pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/8 "2011-09-02T19:48:47Z")

</div>

While this is an old post, it was helpful to me - thanks.

Something else I learned is that msttcorefonts requires an internet connection. If you have a machine or client without an internet connection, fonts can be easily installed per the following instructions: [linuxandfriends.com/2009/07/20/h … tu-debian/](http://linuxandfriends.com/2009/07/20/how-to-install-fonts-in-linux-ubuntu-debian/)

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [June 28, 2012, 2:34pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/9 "2012-06-28T14:34:07Z")

</div>

Java 7 no longer uses the fontconfig.properties file on Linux, though it still has all of the files as if it did. It now uses the Linux font configuration file libfontconfig, which has to be re-built after the fonts are installed.

First, with a text editor, modify the file: `/etc/fonts/conf.avail/60-latin.conf`  
This is an xml file that tells fontconfig which latin font families to prefer for each alias type (serif, sans-serif, monospace, etc.). Move or delete font families under each appropriate alias to get the preferred fonts to the top of each list.

Next, to rebuild libfontconfig, run the following from the command line (prefix sudo if appropriate, of course):

```auto
dpkg-reconfigure fontconfig
```

---

<div class="post-metadata">

**Author:** ![klesher](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@klesher](https://forum.inductiveautomation.com/u/klesher)\
**Post date:** [November 5, 2012, 7:58pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/10 "2012-11-05T19:58:17Z")

</div>

Sorry to bump such an old thread, but I wanted to augment pphillips’ most recent post in case it’s useful to some other Linux user. Thanks for the post by the way. This was extremely helpful!

I’m a Linux user for my daily computing needs, but all of the users who run the Ignition clients run Windows. I had an issue where alignment of text wasn’t showing up the same in Windows and Linux, so I was forced to develop for Ignition within Windows (through a VM, at least). We’ve been running the gateway through Windows, so I assumed that was all that Inductive supported it for.

I recently decided to give it another go on Linux, since I recently found that the Ignition gateway specifically supports Linux as well. Here are the font orderings in the XML file mentioned by pphillips that I moved to achieve the same look and feel as on Windows. I need to do a bit more in depth testing for it, but the screens that I’ve looked at so far look good to me on Linux. The following XML elements should be moved to the top within their respective … grouping:

`
<family>Times New Roman</family>
<family>Arial</family>
<family>Lucida Sans Unicode</family>
<family>Helvetica</family>
<family>Courier New</family>
<family>Courier</family>
<family>Impact</family>
<family>Comic Sans MS</family>`

---

<div class="post-metadata">

**Author:** ![kwj](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@kwj](https://forum.inductiveautomation.com/u/kwj)\
**Post date:** [May 1, 2013, 3:11pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/11 "2013-05-01T15:11:19Z")

</div>

Has anyone else had any success (or lack of) with the techniques described above? I am running java 7 on a test linux client and after installing the ms fonts package, changing the font preference config file and running reconfiguring via dpkg, I’m still seeing native linux fonts.

In the attached file, the top half is windows, bottom is linux. Does anyone know the name of the font in the linux shot? Maybe Deja Vu Sans? I’m trying to pin it down so I can at least attack it from that direction.

Thanks for posting all the tips. Its very helpful.  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1377db6af01fea9a789b134f18b82e3ab56e4c57.jpg)

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [May 1, 2013, 4:19pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/12 "2013-05-01T16:19:11Z")

</div>

Typically, the default sans-serif font in Ubuntu is Lucinda Sans. In the “60-latin.conf” file, I normally add “Arial” somewhere above “Lucinda Sans”, since the one at the top gets preference. Of course, if you change this file, you should rebuild the libfontconfig file.

The other thing is to first make sure the msttcorefonts got installed ok. They should be somewhere in one of the directories pointed to by “/etc/fonts/fonts.conf”. To make sure linux recognizes the fonts, run:

```auto
$ sudo fc-cache -f -v
```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![kwj](https://avatars.discourse-cdn.com/v4/letter/k/838e76/32.png) [@kwj](https://forum.inductiveautomation.com/u/kwj)\
**Post date:** [May 1, 2013, 4:58pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/13 "2013-05-01T16:58:39Z")

</div>

running that and grep’ing for ms gives: “/usr/share/fonts/truetype/msttcorefonts: caching, new cache contents: 60 fonts, 0 dirs”

I’ve got arial and helvetica at the top of my 60-latin.conf file [60-latin.conf.txt](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fffac2ab6660c8ce3b54936c54d0f0b791ee0375.txt) (1.66 KB). Did you have to reinstall java or re-download the jnlp file or anything?

Thanks again for posting the tips.

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [May 7, 2013, 1:55pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/14 "2013-05-07T13:55:47Z")

</div>

Sorry, I misspoke about the default fonts - you were correct, Ubuntu default is DejaVu Sans rather than Lucinda Sans.

From my experience, you should not have to re-load Java or the jnlp file, but you may need to re-start the application. I think Java should pick this up when it starts up.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [July 28, 2014, 7:06pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/15 "2014-07-28T19:06:05Z")

</div>

pphillips’ method will not work if an operating system specific fontconfig properties file exists that matches the operating system.

For example, if on Ubuntu the “/usr/lib/jvm/java-7-oracle/jre/lib/fontconfig.Ubuntu.properties” file must be removed.

I recently wrote a blog post about [installing Windows fonts in Java on Linux](http://www.perfectabstractions.com/blog/how-to-install-windows-fonts-in-java-on-linux).

---

<div class="post-metadata">

**Author:** ![pphillips](https://avatars.discourse-cdn.com/v4/letter/p/da6949/32.png) [@pphillips](https://forum.inductiveautomation.com/u/pphillips)\
**Post date:** [August 15, 2014, 1:58pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/16 "2014-08-15T13:58:30Z")

</div>

Thanks Nick, for posting this. Good to have this clarified and in one location.

---

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [October 8, 2014, 4:22am UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/17 "2014-10-08T04:22:04Z")

</div>

Trying to bump this up - the above packages no longer seem to be available. Anyone know how to install the MSfonts now?

Thanks!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 8, 2014, 12:08pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/18 "2014-10-08T12:08:40Z")

</div>

Worked for me (Ubuntu 14.04).

```auto
apt-get install ttf-mscorefonts-installer
```

Using this works too, it automatically substituted ttf-mscorefonts-installer

```auto
apt-get install msttcorefonts
```

What’s missing for you?

---

<div class="post-metadata">

**Author:** ![allenr8](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@allenr8](https://forum.inductiveautomation.com/u/allenr8)\
**Post date:** [October 8, 2014, 9:00pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/19 "2014-10-08T21:00:41Z")

</div>

Package ttf-mscorefonts-installer is not available, but is referred to by another package.  
This may mean that the package is missing, has been obsoleted, or  
is only available from another source

Same version of Ubuntu…

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [October 9, 2014, 1:32pm UTC](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112/20 "2014-10-09T13:32:02Z")

</div>

That’s odd, I just tried it on a fairly virgin install of Ubuntu 14.04 (only change from stock was removing IcedTea and installing Java 8 ), and it worked great.

Are you running headless or anything unusual like that? Did you disable the multiverse repositories?

[Next page](https://forum.inductiveautomation.com/t/java-fonts-and-linux/1112.md?page=2)
