Font glyph fallthrough in Java

533 views Asked by At

Does anyone know of an existing solution for font glyph fallthrough in Java? For example, our designers have decided that Calibri is the font that mostly fits our needs, but if I specify Calibri, it can naturally not render characters that do not have a matching glyph in that font. In that case, I would need it to fall through to a second specified font, and if all else fails - use one of Java's logical fonts.

Has anyone come up with a solution for this, which can be plugged into existing Swing components without having to write custom Swing components for the entire project?

This is a very old project already, and building custom graphical components is not a feasible solution.

1

There are 1 answers

4
VGR On

This isn't a code-based solution and probably won't be of much help, since it requires each user to install a file locally, but just in case...

You can add fallback fonts in a special directory within the JRE installation. From the Java documentation:

Users can add a physical font as a fallback font to logical fonts used in Java 2D rendering by installing it in the lib/fonts/fallback directory within the JRE.