OpenJFX is not using FontConfig

Fabian Keller mail at fabiankeller.de
Wed Jan 8 15:30:19 UTC 2020


Hi,
I'm currently investigating a problem where openjfx is not using
FontConfig on a CentOS machine.

Error message:
...
Loading FontFactory com.sun.javafx.font.freetype.FTFactory
Subpixel: enabled
Freetype2 Loaded (version 2.8.0)
LCD support Disabled
Fallback fontDir is /root/jdk-11.0.5+10/lib/fonts exists = false
java.io.FileNotFoundException: null/allfonts.properties (No such file
or directory)
Fall back to opening the files
 *** FONTCONFIG LOCATED FONTS:
Not using FontConfig
Fontconfig returned no font for sans:regular:roman
...

I'm using openjfx bundled with my application in a fat jar.
(dependencies javafx-base, javafx-web, javafx-swing) (Tested openjfx
versions: 11, 11.0.1, 13, 13.0.1)
The jar is working without any problems on two different machines, one
with a fresh installation of CentOS 7.4 with Gnome.
On other existing machines (CentOS 7.4) i see the error above,
terminating with jvm core dump due to no available fonts.
I tested the behaviour with two jdk distributions from adoptopenjdk
(OpenJDK11U-jdk_x64_linux_hotspot_11.0.5_10) and Bellsoft
(bellsoft-jdk11.0.5+11).

FontConfig seem's to work properly
# fc-match sans.regular
DejaVuSans.ttf: "DejaVu Sans" "Book"
# fc-match sans:regular:roman
DejaVuSans.ttf: "DejaVu Sans" "Book"

The jvm command line i used:
java -Dprism.useFontConfig=true -Dprism.debugfonts=true
-Dprism.verbose=true -cp nalf.jar de.dummy.Main

I took a look at the source which produces the line "Not using FontConfig":
https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/javafx/font/FontConfigManager.java#L161

If I read correctly the only case where this output can happen is if
'useFontConfig' is false.

The only assignment of 'useFontConfig' is here:
https://github.com/openjdk/jfx/blob/master/modules/javafx.graphics/src/main/java/com/sun/javafx/font/FontConfigManager.java#L52

useFontConfig should only be false if the property
'prism.useFontConfig' is not equals 'true'. But I set it explicitly to
"true" (default should also be true).


Does anybody have a clue, what's the problem or has anybody an idea
how to debug this further?


Best regards
Fabian Keller


More information about the openjfx-dev mailing list