How do I get all the font names supported by java using jdk1.1.8?

Scott Stanchfield

There are two "types" of font names you can deal with in Java

  • Logical Font Names
  • System Font Names

Logical font names are the names Java uses for platform independence. These are names like "Serif" and "Dialog". You can obtain these names by calling

String[] fontNames = 

System font names are those specific to the operating system on which you are running. The code API does not provide a means to do this in JDK 1.1.8. However, this support is provided in the Java 2 Platform through class GraphicsEnvironment.

You can use Java Native Interface (JNI) to call platform-specific code to obtain the list for JDK 1.1.8, and there are probably some class libraries that provide this support, though it would be platform-specific.

About | Sitemap | Contact