Spec-Zone .ru
спецификации, руководства, описания, API
|
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.
The SDK's physical fonts offer the following benefits:
Your applications will look the same on all platforms because they will be using the same fonts. This makes testing, deployment, and support easier in a cross-platform environment.
You don't have to switch fonts if you use characters from various scripts. For example, in a text component that uses the Lucida Sans Regular font, you can display characters in Hebrew, Arabic, German, and English, which are all included as part of the SDK's Lucida Sans Regular font. (Asian character sets for the physical fonts are not supported in the current release.)
All of the physical fonts of the Java 2 Platform support the Euro currency symbol.
GraphicsEnvironment.getAvailableFontFamilyNames
Returns an array of font family names available for use, including font families provided by the host platform as well as the families provided by the SDK.
GraphicsEnvironment.getAllFonts
Returns an array of physical fonts in this environment. The fonts returned include the fonts supplied by the host platform and the physical fonts of the SDK.
Font
constructor. For example, this
constructor would create a Font
instance for the
Lucida Sans Regular font.
The following example would create aFont f = new Font("Lucida Sans", font.PLAIN, 12)
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.