The <font-properties/> command

This command is used to assign values to one or more font properties. The assignments remain in effect within the scope of the current element and its descendants.

The command format is:

<font-properties
 typeface="NAME"
 size="VALUE"
 leading="VALUE"
 italic="STATE"
 bold="STATE"
 super="STATE"
 sub="STATE"
 small="STATE"
 underline="STATE"
 lowercase="STATE"
 uppercase="STATE"
 reverse="STATE"
 frame="STATE"
 overbar="STATE"
 strikeout="STATE"
 color="COLOR"
 char-space="SPACE"
 fptype="TYPE"
 fpsize="PERC"
 fpvshift="VALUE"
 fpabove="PERC"
 fpbelow="PERC"
 thinspace="SPACE"
/>

where :

  • A font characteristic is enabled if the value of STATE is one of the following: on, yes, 1, or enable.

  • A font characteristic is disabled if the value of STATE is one of the following: off, no, 0, or disable.

The typeface attribute specifies the name of a typeface or a typeface selection scheme.

The size attribute contains a measure that sets the font size. Setting the font size in this way resets the horizontal scaling and baseline shift to their default values and disables superscript and subscript.

The leading attribute contains a measure that sets the current leading. If the size is changed without setting a leading value, the leading is set to the same value as the size.

The color attribute specifies the current font color. See “Colors” for a description of how colors are specified.

The value of STATE is not case sensitive. The <font-properties/> directive can be used to assign a state from the resolved string value of an attribute variable or user variable, providing the value is one of the alternatives listed above.

The following example shows how to set the state of the italic font characteristic using the values held in the italic attribute :

<font-properties italic="{@italic}" />

The char-space attribute specifies an amount to be added to the effective width of each character. See Character spacing for more information.

Thin space width

In TopLeaf, the width of a thin space (U+2009) is equal to the width of a 1/4 em space. For some document styles or languages you may need to redefine the thin space width. The value of SPACE specifies the width of a thin space expressed as a percentage of the current font size. The following table shows how to redefine the thin space width to some commonly used alternatives:

Width Command
1/5 em <font-properties thinspace="20" />
1/6 em <font-properties thinspace="16" />

Configuring font characteristics

The command:

<font-properties fptype="TYPE" ... />

configures the properties of a single font characteristic, where TYPE is one of the following: super, sub, small, reverse, or frame.

You can configure the following properties:

  • fpsize. If specified, defines the relative font size of the characteristic declared by fptype, expressed as a percentage of the current font size. If not specified a predefined algorithm is used to calculate the size.

  • fpvshift. If specified, defines the baseline position for the characteristic for a superscript or subscript effect. The value is a percentage of the current font size. A positive value causes the effect to appear lower on the page, while a negative value raises it. If not specified a predefined algorithm is used to calculate the baseline position.

  • fpabove. If defined, specifies the distance between the cap height and the top of a reverse or frame effect. The distance is a positive value specified as a percentage of the current font size.

  • fpbelow. If defined, specifies the distance between the baseline and the bottom of a reverse or frame effect. The distance is a positive value specified as a percentage of the current font size.

Defaults for configurable characteristics

TopLeaf uses a predefined algorithm when calculating the default font size for superscript, subscript, and small fonts. Consequently, the default relative font size for these characteristics is between 66% and 75% of the current font size. By default, superscripts are raised by approximately 40% of the current font size, and subscripts are lowered by approximately 20% of the current font size.

Example

The following command sets the superscript font size to 58% of the current font size, and the superscript position to 33% above the baseline:

<font-properties fptype="super" fpsize="58" fpvshift="-33" />
[Note] Note

Use multiple <font-properties/> commands if you need to configure more than one font characteristic. The configuration settings remain active within the scope of the current element and its descendants.

Any user configuration of a font characteristic must be declared when mapping an ancestor tag (for example, the parent) of the element in which the configured font characteristic is applied. This means that changing the characteristics of, say, superscript cannot be done by the mapping that selects superscript.

[Note] Note

In previous versions the argument letter-space was allowed. This is deprecated and may be removed in future versions. Use the char-space argument instead.