Jayan
Jayan

Reputation: 18459

Java- load only fonts from jre/lib/fonts

Java runtime adds fonts from system to its GraphicsEnvironment. Oracle/Sun documentation on fontconfig.properties is here. These explain how to add fonts to Java.

I am looking for restricting the font loading(testing). Unloading a loaded font is not straightforward (discussed here Unregister font with GraphicsEnvironment?)

Is there a way to restrict java to load fonts listed in jre/lib folder?

Upvotes: 0

Views: 1877

Answers (1)

apangin
apangin

Reputation: 98294

Specify empty sun.java2d.fontpath property to prevent from loading system fonts.

  java -Dsun.java2d.fontpath= -jar YourApp

Upvotes: 1

Related Questions