http://java.sun.com/javase/6/docs/technotes/guides/intl/fontconfig.html

读懂fontconfig 配置文件

The Java 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 SE Runtime Environments use font configuration files to map logical font names to physical fonts. There are several files to support different mappings depending on the host operating system version. The files are located in the lib directory within the JRE installation. Users can edit or create their own font configuration files to adjust the mappings to their particular system setup. Note however that this is a modification of the JRE, and Sun does not support modified JREs.

Font configuration files come in two formats: A properties format and a binary format. The properties format is described in detail in this document and can be used for user-defined configurations. The binary format is undocumented and used only for the JRE's predefined configurations; the corresponding files in properties format are available for reference as files with the ".properties.src" extension.

 

Loading Font Configuration Files

To find the appropriate font configuration file for a host operating system, the following information is used:

  • JavaHome - the JRE's directory, as given by the "java.home" system property.
  • OS - a string identifying an operating system variant:
    • For Windows, "98", "2000", "Me", "XP", "2003".
    • For Solaris, empty.
    • For Linux, "Sun", "Red Hat", "Turbo", "SuSE".
  • Version - a string identifying the operating system version.

The runtime uses the first of the following files it finds:

	JavaHome/lib/fontconfig.OS.Version.properties
	JavaHome/lib/fontconfig.OS.Version.bfc
	JavaHome/lib/fontconfig.OS.properties
	JavaHome/lib/fontconfig.OS.bfc
	JavaHome/lib/fontconfig.Version.properties
	JavaHome/lib/fontconfig.Version.bfc
	JavaHome/lib/fontconfig.properties
	JavaHome/lib/fontconfig.bfc

Files with a ".properties" suffix are assumed to be properties files as specified by the Properties class and are loaded through that class. Files without this suffix are assumed to be in binary format.

 

 

The Java runtime uses sequence properties to determine search sequences for the five logical fonts. However, a font configuration file may specify properties that are specific to a combination of encoding, language, and country, and the runtime will then use a lookup to determine the search sequence property for each logical font.

The keys have the form:

	sequence.allfonts.Encoding.Language.Country
	sequence.LogicalFontName.Encoding.Language.Country
	sequence.allfonts.Encoding.Language
	sequence.LogicalFontName.Encoding.Language
	sequence.allfonts.Encoding
	sequence.LogicalFontName.Encoding
	sequence.allfonts
	sequence.LogicalFontName

The allfonts forms are used if the sequence is used for all five logical fonts. The forms specifying logical font names are used if different sequences are used for different logical fonts.

For each logical font, the Java runtime uses the property value with the first of the above keys. This property determines the primary search sequence for the logical font.