I'm using JavaFX 1.8u40 on Red Hat Enterprise Linux Workstation release 6.6 (Santiago). When I run up a standard JavaFX application even without additional CSS, all the labels, menus etc. are displayed using a monospace font.
The system I'm using only has the following TTF fonts available
/usr/share/fonts/liberation
/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
/usr/share/fonts/liberation/fonts.dir
/usr/share/fonts/liberation/LiberationMono-Italic.ttf
/usr/share/fonts/liberation/LiberationSans-Bold.ttf
/usr/share/fonts/liberation/LiberationSerif-Bold.ttf
/usr/share/fonts/liberation/LiberationMono-Regular.ttf
/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
/usr/share/fonts/liberation/LiberationSerif-BoldItalic.ttf
/usr/share/fonts/liberation/fonts.scale
/usr/share/fonts/liberation/LiberationSans-Regular.ttf
/usr/share/fonts/liberation/LiberationSans-Italic.ttf
/usr/share/fonts/liberation/LiberationMono-Bold.ttf
I've debugged this using -Dprism.debugfonts
from OpenJFX fonts guide. The output is as follows.
Loading FontFactory com.sun.javafx.font.freetype.FTFactory
Subpixel: enabled
Freetype2 Loaded (version 2.3.11)
LCD support Enabled
Time spent accessing fontconfig=4ms.
FC font sans:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font sans:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font sans:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font sans:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font serif:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font serif:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font serif:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font serif:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font monospace:regular:roman maps to Liberation Mono in file /usr/share/fonts/liberation/LiberationMono-Regular.ttf
0) Family=Liberation Mono, Style=Regular, Fullname=Liberation Mono, File=/usr/share/fonts/liberation/LiberationMono-Regular.ttf
1) Family=Liberation Sans, Style=Regular, Fullname=Liberation Sans, File=/usr/share/fonts/liberation/LiberationSans-Regular.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font monospace:bold:roman maps to Liberation Mono Bold in file /usr/share/fonts/liberation/LiberationMono-Bold.ttf
0) Family=Liberation Mono, Style=Bold, Fullname=Liberation Mono Bold, File=/usr/share/fonts/liberation/LiberationMono-Bold.ttf
1) Family=Liberation Sans, Style=Bold, Fullname=Liberation Sans Bold, File=/usr/share/fonts/liberation/LiberationSans-Bold.ttf
2) Family=Liberation Serif, Style=Regular, Fullname=Liberation Serif, File=/usr/share/fonts/liberation/LiberationSerif-Regular.ttf
FC font monospace:regular:italic maps to Liberation Mono Italic in file /usr/share/fonts/liberation/LiberationMono-Italic.ttf
0) Family=Liberation Mono, Style=Italic, Fullname=Liberation Mono Italic, File=/usr/share/fonts/liberation/LiberationMono-Italic.ttf
1) Family=Liberation Sans, Style=Italic, Fullname=Liberation Sans Italic, File=/usr/share/fonts/liberation/LiberationSans-Italic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC font monospace:bold:italic maps to Liberation Sans Bold Italic in file /usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
0) Family=Liberation Sans, Style=Bold Italic, Fullname=Liberation Sans Bold Italic, File=/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf
1) Family=Liberation Mono, Style=Bold Italic, Fullname=Liberation Mono Bold Italic, File=/usr/share/fonts/liberation/LiberationMono-BoldItalic.ttf
2) Family=Liberation Serif, Style=Italic, Fullname=Liberation Serif Italic, File=/usr/share/fonts/liberation/LiberationSerif-Italic.ttf
FC name=sans style=0 uses Liberation Mono in file: /usr/share/fonts/liberation/LiberationMono-Regular.ttf
I've discovered using -Dprism.useFontConfig=false causes JavaFX to default to built in Lucida fonts, however I need to use the Liberation files in /usr/share/fonts
Questions
Update
The problem appears to be in the fontconfig rules in /etc/fonts/conf.d/, not JavaFX. I've not yet been able to figure out to fix this, but using fc-match produces the same results
fc-match sans:regular:roman
"LiberationMono-Regular.ttf": "Liberation Mono" "Regular"
I found a similar problem on another forum: Font issue, monospace used for serif and sans-serif families, but without a solution.
Adding a font config file, e.g. /etc/fonts/conf.d/88-liberation-hack.conf
will fix the issue
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<alias>
<family>sans-serif</family>
<prefer><family>Liberation Sans</family></prefer>
</alias>
<alias>
<family>serif</family>
<prefer><family>Liberation Serif</family></prefer>
</alias>
<alias>
<family>monospace</family>
<prefer><family>Liberation Mono</family></prefer>
</alias>
</fontconfig>