|
|
|
The Java 2 platform defines five logical font names that every implementation must support: Serif, SansSerif, Monospaced, Dialog, and DialogInput. These logical font names are mapped to physical fonts in implementation dependent ways.
Sun's Java 2 Runtime Environments use font.properties files to map logical font names to physical fonts. There are several files to support different mappings depending on host operating system version and locale. The files are located in the lib directory within the J2RE installation. Users can edit or create their own font.properties files to adjust the mappings to their particular system setup. Note however that this is a modification of the J2RE, and Sun does not support modified J2REs.
Note that font.properties files are implementation dependent. Not all implementations of the Java 2 platform use them, and the format and content vary between different runtime environments as well as between releases. This document describes the format used by version 1.4.0 of Sun's Java 2 Runtime Environments.
The font.properties files are properties files as specified by the
Properties
class and are loaded through that class. To find the appropriate
file, the following information is used:
"NT"
, "95"
,
"98"
, "2000"
, "Me"
,
"XP"
.
"Redhat"
, "Turbo"
,
"SuSE"
.
The runtime uses the first of the following files it finds:
JavaHome/lib/font.properties.
Language_
Country_
Encoding.
OSVersion JavaHome/lib/font.properties.
Language_
Country_
Encoding.
OS JavaHome/lib/font.properties.
Language_
Country_
Encoding.
Version JavaHome/lib/font.properties.
Language_
Country_
Encoding JavaHome/lib/font.properties.
Language_
Country.
OSVersion JavaHome/lib/font.properties.
Language_
Country.
OS JavaHome/lib/font.properties.
Language_
Country.
Version JavaHome/lib/font.properties.
Language_
Country JavaHome/lib/font.properties.
Language_
Encoding.
OSVersion JavaHome/lib/font.properties.
Language_
Encoding.
OS JavaHome/lib/font.properties.
Language_
Encoding.
Version JavaHome/lib/font.properties.
Language_
Encoding JavaHome/lib/font.properties.
Language.
OSVersion JavaHome/lib/font.properties.
Language.
OS JavaHome/lib/font.properties.
Language.
Version JavaHome/lib/font.properties.
Language JavaHome/lib/font.properties.
Encoding.
OSVersion JavaHome/lib/font.properties.
Encoding.
OS JavaHome/lib/font.properties.
Encoding.
Version JavaHome/lib/font.properties.
Encoding JavaHome/lib/font.properties.
OSVersion JavaHome/lib/font.properties.
OS JavaHome/lib/font.properties.
Version JavaHome/lib/font.properties
Throughout the font.properties files, a number of different names are used:
serif
, sansserif
,
monospaced
, dialog
, and
dialoginput
. In font.properties files, these names
are always in lowercase.
Some existing font.properties files also use other names as
logical font names, such as helvetica
or
zapfdingbats
. This usage is deprecated, and support
for it will be removed in a future release.
plain
, bold
, italic
, and
bolditalic
. Again, these names are always in
lowercase.
"Courier
New"
or "\uad74\ub9bc"
.
"-monotype-times new
roman-regular-r---*-%d-*-*-p-*-iso8859-1"
. Note that
"%d"
is used for the font size - the actual font
size is filled in at runtime.
ANSI_CHARSET
,
DEFAULT_CHARSET
, SYMBOL_CHARSET
,
SHIFTJIS_CHARSET
, GB2312_CHARSET
,
HANGEUL_CHARSET
, CHINESEBIG5_CHARSET
,
OEM_CHARSET
, JOHAB_CHARSET
,
HEBREW_CHARSET
, ARABIC_CHARSET
,
GREEK_CHARSET
, TURKISH_CHARSET
,
VIETNAMESE_CHARSET
, THAI_CHARSET
,
EASTEUROPE_CHARSET
, RUSSIAN_CHARSET
,
MAC_CHARSET
, BALTIC_CHARSET
.
Component font mapping properties describe which physical fonts to use to render characters with a given logical font in a given style. Typically there are several component font entries for each combination of logical font and style so as to cover a wide range of Unicode characters. The entries are identified by component indices. When rendering a character, the runtime checks the component fonts in the sequence defined by the component indices and uses the first one that can render the character and is not excluded.
The keys have the form:
ComponentFontMappingKey: LogicalFontName.
StyleName.
ComponentIndex LogicalFontName.ComponentIndex
If the StyleName is omitted, it's assumed to be
plain
. Within one logical font, the style name
plain
must either be present for all entries or omitted
for all entries. The ComponentIndex identifies a component
font entry within the set of entries for the same logical font and
style. If there are n entries for a logical font and style, their
indices must be 0 to n-1. Component indices must be used consistently
between different styles for the same logical font, because some
other properties only refer to the logical font name and the
component index.
The form of the values depends on the platform. For Solaris and Linux, the values are platform font names. For Windows, the values have the form:
PlatformFontName
,
WindowsCharsetName
The Windows charset name identifies the primary character set that this font is supposed to cover. The Java 2 runtime environment uses this information to select the component font to use in peered AWT text components, and Windows may use it to substitute a different font if the specified one cannot be found.
Component font character encoding properties indicate which character encoding AWT should use when accessing the corresponding component fonts. These properties are only needed if the component fonts cannot be accessed using Unicode - newer TrueType fonts can usually be accessed using Unicode and don't need this property.
The keys have the form:
fontcharset.
LogicalFontName.ComponentIndex
The values are fully qualified class names of character converters. In this release, character converters are accessed using the old sun.io interfaces, so only the character encodings provided by the Java 2 Runtime Environment can be used. The class names for the publicly supported character encodings are of the form:
sun.io.CharToByte
CanonicalName
In a future release, character converters will be accessed through the new java.nio.charset API, which will enable the use of third-party character converters.
The exclusion range properties specify Unicode character ranges which should be excluded from being rendered with a given component font. This is used if a font with a large character repertoire needs to be placed early in the search sequence (for example, for performance reasons), but some characters that it supports should be drawn with a different font instead.
The keys have the form:
exclusion.
LogicalFontName.ComponentIndex
The values have the form:
ExclusionRangeValue: Range Range,
ExclusionRangeValue Range: Char-
Char Char: HexDigit HexDigit HexDigit HexDigit
A Char is a Unicode character represented as a hexadecimal value.
Font name aliases are deprecated, and support for them will be removed in a future release.
The keys have the form:
alias.
LogicalFontName
The values have the form:
LogicalFontName
Missing glyph character definitions are deprecated, and support for them will be removed in a future release.
The keys have the form:
default.char
The values have the form:
Char
Font file name properties provide the names of the files containing the physical fonts used in the font.properties file. Providing a complete set of file names reduces startup time, since the runtime system doesn't need to open all available font files to find the fonts.
The keys have the form:
filename.
PlatformFontName
Space characters in the platform font name must be replaced with underscore characters ("_").
The values are the simple file names of the files containing the
fonts. The runtime environment will look for the file first in its
own lib/fonts
directory, then in the Windows fonts
directory.
Text input character set definitions are deprecated, and support for them will be removed in a future release.
The keys have the form:
textinputcharset
The values have the form:
WindowsCharsetName
For peered components such as java.awt.TextComponent
,
the Java runtime needs to provide X with an XFontSet. The X font set
properties provide a mapping from each combination of logical font
and style to an X font set. In addition, a default X font set needs
to be defined.
The keys have the forms:
fontset.LogicalFontName.StyleName fontset.default
The values have the form:
FontSetValue: PlatformFontName PlatformFontName , FontSetValue
Copyright © 2002 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: java-intl@java.sun.com |
|