Customizing the font index file for xml2afp

The sample font index file for xml2afp is provided in /usr/lpp/psf/xmltransform on AIX and install_path\xmltransform on Windows. The samples include a outline_font_index and a raster_font_index that you use to map XML font names to both outline FOCA fonts and raster fonts in the font path.

Note: If you are using OpenType fonts, the font index files are not necessary.

A font is referenced in XSL-FLO using these attributes:

  • family
  • size
  • style
  • weight
Font index files describe AFP fonts using these attributes. In addition, a map is defined that maps unicode code points to AFP code points.

The font index file consists of a sequence of key and value pairs, separated by whitespace (such as a space, tab, or a newline). Comments can be inserted anywhere between the delimiters /* and */. You can also use // to indicate that the remainder of the current line is a comment.

The keys and their meanings are:

map
Select the named character map, creating it if it does not exist. A character map is used to map unicode code points to AFP code page names and code points. The default is default.
codepage
Set the code page to use for subsequent character mappings.
to
End a range of mapped unicode code points. The value must be an integer representing a valid unicode code point, and it must be greater than the beginning value of the range given by the closest preceding value for the char keyword. The value must be a valid unicode code point.
at
Creates a mapping using the closed range given by a preceding char value and an optional to value. The unicode characters from begin to end are mapped to the AFP code point range from the at value to the at value + end - begin, inclusive, using the closest preceding codepage value. This value must be an integer from 0 to 65535.
family
Establish the current font family name. The value must be a string containing no whitespace characters.
size
A font size, expressed as a floating point value giving the vertical size of the font, in points (1/72nds inches). Size must be omitted when defining outline technology fonts, since they can take any size.
style
A font style. The value must be one of these keywords:
  • normal
  • italic
  • oblique
  • backslant
The default is normal.
weight
A font weight. The value can be one of these keywords:
  • normal
  • bold
The value might also be one of the values between 100 and 900 inclusive, in increments of 100. The keyword normal is equivalent to 400, and the keyword bold is equivalent to 700. The default value is normal (400).
charset
Define a font with the preceding values given for the font properties (family, size, style, and weight), or default values if no preceding property values have been established. The currently selected character map is associated with the font, and it is used for mapping unicode code points when the font is selected. If modifications are made to the map later in the file, those changes do not affect the defined font.
alias
Establish a font family alias for the current family.

Of the keywords listed, only two are active: at and charset. The other keywords collect values used when an active keyword is found. This allows for a variety of possible arrangements for a font index. For example:

family courier
alias monospace
	size 7
		weight normal
			style normal
				charset C04200070
			style italic
				charset C0430070
		weight bold
			style normal
				charset C0440070
			style italic
				charset C0450070
Defines the same set of fonts as:

family courier	size 7	weight normal style normal charset C0420070
family courier	size 7	weight normal	style italic charset C0430070
family courier	size 7	weight bold style normal charset C0440070
family courier	size 7	weight bold style italic charset C0450070
alias monospace
But can be considered more difficult to read.