Physical Fonts


Starting with the 1.2 release, the Java 2 SDK includes a set of TrueType fonts in the lib/fonts subdirectory. Prior to the 1.2 release, the JDK software relied on the host platform fonts. Logical fonts, such as Monospaced, are mapped to the host platform fonts in the font.properties file. To distinguish them from the logical fonts, this document refers to the TrueType fonts as physical fonts.

Benefits

Because physical fonts are included in the Java 2 Platform itself, programmers are guaranteed to have a uniform set of font families available for several locales for use on whatever host platform the Java runtime environment is on. This obviously lessens programmer's dependence on the fonts might be provided by the host platform, which can vary greatly from platform to platform, and from locale to locale.

The SDK's physical fonts offer the following benefits:

The Physical Fonts Supplied by the Java 2 Platform

The Java 2 SDK provides three font families: Lucida Sans, Lucida Bright, and Lucida Sans Typewriter. Each family contains four fonts, for a total of 12 fonts:

Related Methods in the Java 2DTM API

Using the SDK's Physical Fonts

You can use the physical fonts in the SDK in the same way that you'd use any other fonts such as those supplied by the underlying platform. For example, you can create an instance of the Lucida Sans Regular font with the usual Font constructor. For example, this constructor would create a Font instance for the Lucida Sans Regular font.
Font f = new Font("Lucida Sans", font.PLAIN, 12)
The following example would create a Font instance for the Lucida Sans Typewriter Oblique font.
Font f = new Font("Lucida Sans Typewriter", font.ITALIC, 18)

The Java 2 Platform's physical fonts are located in the jre/lib/fonts folder in the Java 2 SDK and in the lib/fonts directory of the Java 2 Runtime Environment. Users can add additional TrueType fonts to this directory for use by their programs. The TrueType fonts must be Unicode encoded.


java-intl@java.sun.com
Copyright © 1998-99 Sun Microsystems, Inc. All rights re served.

Banner.Novgorod.Ru