aXSL Font: Font Configuration

Contents

Future changes to the font configuration are expected, so that more features can be added.

Introduction

Some applications are able to obtain all of the information that they need about available fonts from some universal system registry, usually maintained by the operating system. In such cases, a font-configuration is not needed. However, in any case where such information is not available, may not be available, or not adequate for the application, some standard method of communicating information about available fonts is needed. The aXSL font-configuration DTD is an attempt to standardize the format of such information, so that users can avoid the need to maintain multiple configurations for multiple applications. A sample configuration file is also provided, which may be useful either for cut-and-paste or consultation as font-configuration files are created.

The configuration contemplates two general types of fonts. First are those for which at least some information is available from some other registry. In this document, these are referred to as System Fonts (SF). Second are those for which no external information is available at all. These are referred to as Free-standing Fonts (FSF).

The aXSL font-configuration is optimized for flexibility, which makes it somewhat more verbose and complex than it could be. It draws a sharp distinction between configuration of the font itself, which is generally done in the <font> element, and configuration of the way it is used and selected by an application, which is generally done in the <font-description> element. This distincion allows a font to be used in more than one way. Here are some examples where this may possibly be useful:

<axsl-font-config> element

All attributes of axsl-font-config set global defaults that can be overridden by subsidiary elements.

<server> element

Important: Most users do not need to configure server elements and can safely skip this section.

<server
    setup-free-standing-fonts="true"
    setup-system-fonts="false"/>

<parameter> element

<parameter
    key="font-root"
    value="file://C:/some/path"/>

A parameter contains two attributes, "key" and either "value" or "from-environment". These are used within the configuration file as a simple substitution. Wherever the text of "key", enclosed in curly braces, occurs in attributes, it will be substituted with the text of "value" or with the value of the environment variable named in "from-environment". This is useful especially for making the paths to files more flexible.

Note that support for environment variables may vary from one programming language to another, from one environment to another, and from one implementation to another. For example, some java platforms only support environment variables set using the java "-D" switch. Others can get environment variables from the operating system. Consult the documentation for your implementation to determine the exact level of support for this feature.

<glyph-list> element

Important: Most users do not need to configure custom glyph-list elements and can safely skip this section. If you do need to specify or create a glyph-list see the Encoding documentation.

<encoding> element

Important: Most users do not need to configure custom encoding elements and can safely skip this section. If you do need to specify or create an encoding see the Encoding documentation.

<font-group> element

The only purpose of the font-group element is as a wrapper for font elements that have similar attributes, or that should be grouped together for some other reason. An attribute set on font-group will be inherited by contained font elements, unless those elements override the attibute.

<font> element

Here is a sample <font> element in the font configuration file:

<font
    id="DomCasual-Adobe"
    embed="subset"
    metrics-file="type1/adobe/091/dc______.afm"
    font-file="type1/adobe/091/dc______.pfb">
</font>

For both metrics-file and font-file, relative paths and URLs are resolved relative to any parent xml:base attribute. Relative xml:base attributes are themselves resolved relative to any parent xml:base attribute. If no xml:base attribute is set on the root element, applications my set the base either to some configured value known to them, or to the current working directory.

The description above is for the typical configuration of a free-standing font. Some applications need to be able to concurrently support and configure system fonts along with free-standing fonts. These can be obtained in one of two ways:

In either of these cases, the following attribute must be included for the <font> element.

The <font> is intended to represent exactly one logical font. This font can be a simple SF, a simple FSF, or a font that can manifest itself as both an SF and an FSF. In some cases it is possible to abuse the <font> element to represent one SF and a different FSF. This practice is discouraged. A better solution is to use the <font-family-alias> and related <alias-configuration> elements to alias different fonts in different circumstances.

<font-family> element

The font-family element contains one or more font-description elements. When the font-family is selected in a document, the font-description elements are searched for a match on the remaining descriptive items (weight, style, etc.)

<font-description> element

<font-description
    font="NewBaskervilleItalic-Adobe"
    style="italic"
    weight="normal"
    simulate-small-caps="80%"
    encoding="WinAnsiEncoding"/>

Note that the purpose of separating a font-description from its underlying font is to allow the same font to be used multiple ways. The same font can be used within different font-family entries, and can be defined with different characteristics.

The result of defining two font-description elements with identical characteristics in the same font family is undefined. With 9 font-stretch possibilities, 4 for font-style, 2 for font-variant, and 9 for font-weight, there are 648 possible fonts in a font-family.

<font-family-alias> element

<font-family-alias alias="sans-serif"
    default-family="Base14-Helvetica">
  <alias-configuration name="pdf"          font-family="Base14-Helvetica"/>
  <alias-configuration name="awt"          font-family="AWT-sans-serif"/>
</font-family-alias>

The <font-family-alias> and child <alias-configuration> elements are designed to allow a font-configuration to be used for different purposes. The combination of the two allows a font-family to be accessed using more than one name, and allows more than one font-family to be accessed using the same name. In the example above, the font-family "Base14-Helvetica" can be accessed using either the font-family name "Base14-Helvetica" or its alias "sans-serif". On the other hand, the alias "sans-serif" can point to either "Base14-Helvetica" or "AWT-sans-serif", depending on the context or active configuration.

<alias-configuration> element

The <alias-configuration> element is an optional child to the <font-family-alias> element, and allows an alias name to point to different font-family elements depending upon some configuration name. The configuration name is application-dependent. Some applications may choose not to use them at all, and others may have a complex scheme for determining which configuration to use in a given circumstance. A typical use is to distinguish between fonts available for print applications, like PDF and PostScript, from those available for viewing documents on the screen, such as AWT applications.