Java Fonts and Linux


I am running headless. I got it to work after adding the mirror and installing all dependencies on install. Thanks!



Well, I’ve installed msttcorefonts on Ubuntu 10.04 and 12.04 and Java 6 and 7 using these methods with good success each time. However, I’ve used the same technique(s) on Ubuntu 14.04 with Java 8 (jre_8u25) and have had no luck getting it to work. Doesn’t seem to respect the libfontconfig settings or (or no file). The mscorefonts are installed and usable - just won’t substitute Arial for the logical Dialog font.

Any one seen this? Is this a Java 8 bug? Or something different about Ubuntu 14.04?

Unfortunately, since Ignition v7.7 requires Java 8, and I need a client to fall-back to a local gateway, I pretty much have to use Java 8 on one of the clients. Any ideas would be appreciated.



Wasn’t there something about deleting /usr/lib/jvm/java-8-oracle/jre/lib/

EDIT: Oops. It was actually earlier in this thread… :laughing: I suppose I should ask if you did it as a sanity check. :wink:



Yeah, Jordan, from what I’ve seen, the Java jre’s dropped including the file quite a while back. In the Java documentation that I can find, there is mention of Java (version?) using for those Linux versions it doesn’t include explicitly (e.g. RedHat, etc.). I’ve even tried re-naming, etc. to make sure it’s not using them and it doesn’t seem to help either.

In one case, I reverted back to Ubuntu 12.04 and Java 7, and it worked as it previously has with no problem. Next try would be Ubuntu 14.04 with Java 7, but it may be awhile before I get time to try it.



Got some time this morning to dig into this a bit more. Got things working with 14.04 and java 8 (yay!)

Instead of deleting the fontconfig.Ubuntu.propeties file, I modified it, including the corefonts (Arial, Times New Roman, Courier New) (14.9 KB)



Yay is right! Thanks for posting this, Jordan. This is very helpful.



I know this is an old topic, but I am attempting to get the Dialog font changed to Arial to match the Windows clients. I am attempting this on a Raspberry Pi 3. The client runs fine on it, except none of the above instructions have worked on getting the font corrected.

There is no file, but there is and also, and similars (Turbo, etc).

Tried different combinations. Renaming the (downloaded form this thread) to and placing it in the /jre/lib/ path. Modified the 60-latin.conf in /etc/fonts/conf.avail.

Thoughts? Has anyone done this with in Raspian?

Any assistance would be greatly appreciated. Thanks.



BrandonSHill, I ran into the same exact problem. Did you find a fix for yours?



A fresh install of Oracle Java 8 on Ubuntu 16.04 amd64 gave the opportunity to re-test the instructions in this topic. Out-of-the-box the Ignition applications designed on the Windows platform work OK, but the font appearance and spacing is off. Installing the msttcorefonts core fonts package does by itself not fix the problem because Java is separately configured to continue using DejaVu Serif, DejaVu Sans, and DejaVu Sans Mono instead of Times New Roman, Arial, and Courier New.

Starting with a fresh Ubuntu 16.04 installation, use ppa approach from … a-ppa.html to install Java

sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer

Install fonts

apt install msttcorefonts

The Java font file /usr/lib/jvm/java-8-oracle/jre/lib/ can be modified manually or by installing the (14.9 KB)
posted in this thread by user JordanCClark on Tue Apr 28, 2015. A diff showed that the only differences are that the font names are replaced and locations for the msttcorefonts are added. Note that a Java update can re-install the original file, so you may want to keep a copy of your font modifications available.

1 Like


It looks like Rapsbian and Java 7 and Java 8 have some errors regarding the Font Configuration file.

It only responds to $HOME/.java/fonts config file and not the files. It appears that the problem is fixed in Java 9 beta. We will have to wait for Java 9 on Raspberry PI before we can have a properly fixed solution.



Since Ubuntu for some time has included the Red Hat Liberation fonts (same dimensions as MS True Type core fonts), attached is a file that makes the Liberation fonts substitute for Dialog fonts in Java. Not quite as pretty (in my opinion), but they are not bad, and it saves a step or two.

Just copy the attached file to your …/jre*/lib/ folder. As noted in the above posts, however, you will have to do this each time you update Java.

I have confirmed that this works for Java jre1.8.0_111.



Bumping an old topic with fresh instructions:

I was setting up an Ubuntu 18.04 desktop with the OpenJDK-8-jre java install. It uses the system font configuration files and has no file to fiddle with. After much research, trial and error, I found that what I needed to do was:

Install the MS TrueType fonts: sudo apt-get install msttcorefonts

Create the font config file in the proper place, with the proper name: sudo nano /etc/fonts/local.conf

Paste in the font config selecting the MS fonts for the generic names and save it:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- -->
  <!-- Generic name aliasing -->
      <family>Times New Roman</family>
      <family>Courier New</family>

Rebuild the font cache: sudo dpkg-reconfigure fontconfig

Altering the 60-latin.conf file as @nmudge was suggesting wasn’t effective, as I believe there were other, higher priority directives in place on my system. Putting the directives in the local.conf file did the trick.