I am trying to debug a font-related issue in a third-party Java application. Specifically, ChemAxon JChem. I've been consulting this guide: http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html
Part of the problem, is that I'm not sure which fontconfig.properties.src file my Java setup is currently referencing.
Here are my fontconfig files:
$ ls fontconfig*src
fontconfig.Fedora.properties.src fontconfig.properties.src
fontconfig.SuSE.properties.src fontconfig.Ubuntu.properties.src
My system is a CentOS system, so I imagine it is probably either ferencing the default fontconfig.properties.src
file or the fontconfig.Fedora.properties.src
file, since CentOS and Fedora are both derived from Red Hat.
So, can I definitively tell which fontconfig
file my system is using?
Thanks,
-John David
Support for Physical Fonts The JRE looks in two locations: the lib/fonts directory within the JRE itself, and the normal font location(s) defined by the host operating system. If fonts with the same name exist in both locations, the one in the lib/fonts directory is used.
Java defines five logical font families that are Serif, SansSerif, Monospaced, Dialog, and DialogInput.
Fontconfig is a library designed to provide system-wide font configuration, customization and application access.
The JRE class sun.awt.FontConfiguration already has logging for this, you just need to enable it.
-Dsun.java2d.debugfonts=true
Change this line
java.util.logging.ConsoleHandler.level = ALL
Add this line
sun.awt.FontConfiguration.level = ALL
And you'll then see a line like this in your stderr (logger uses stderr for some reason)
CONFIG: Read logical font configuration from /your/path/jre/lib/fontconfig.RedHat.6.bfc
Just use strace to check which of those files is successfully opened:
$ strace -f -e open java ... 2>&1 | grep fontconfig
[pid 3321] open("/usr/java/jdk1.7.0_55/jre/lib/fontconfig.RedHat.6.bfc", O_RDONLY|O_LARGEFILE) = 115
If this doesn't tell you which file it is using, chances are that it is using system wide fonctconfig instead. You will get an output starting like this then:
[pid 3259] open("/usr/java/jdk1.7.0_55/jre/lib/i386/xawt/libfontconfig.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3259] open("/usr/java/jdk1.7.0_55/jre/lib/i386/xawt/../libfontconfig.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3259] open("/usr/java/jdk1.7.0_55/bin/../lib/i386/jli/libfontconfig.so.1", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 3259] open("/usr/lib/libfontconfig.so.1", O_RDONLY) = 116
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With