Failure to find any font (probably on Embedded)

David Hill David.Hill at Oracle.com
Wed Feb 12 13:37:27 PST 2014


I am chasing a edge case that probably only happens in certain Embedded configurations. If we don't find *any* fonts, then we quietly fail and blame it on CSS :-)

I say blame it on CSS because the resulting hard failure is:
Exception in thread "JavaFX Application Thread" java.lang.NoClassDefFoundError: Could not initialize class javafx.scene.CssStyleHelper
This is because CSS needs a font for various calculations.

With Embedded, if libfontconfig is not present (or improperly configured) you will not find any fonts.

I would like thoughts on my putting a more informative error message out, and making zero fonts an earlier hard failure.

What I would really like to do is to be able to put a URL to a Fonts wiki page (like: https://wiki.openjdk.java.net/display/OpenJFX/Font+Setup) but not sure how well that would stand up to the test of time.

The code point in FontConfigManager is:

         if (anyFont == null) {
             if (debugFonts) {
                 System.err.println("Fontconfig returned no fonts at all.");
             }
             fontConfigFailed = true;
             return;

-- 
David Hill <David.Hill at Oracle.com>
Java Embedded Development

"A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools."
-- Douglas Adams



More information about the openjfx-dev mailing list