The <text-properties/> command

Sets text properties for the current element.

Where allowed

Any mapping.

Range of effect

This command comes into effect when called and lasts until the end of the current element. For example, if called within the Start tag custom content, the command would apply to the content of the current element (and its descendants) and the content of the End tag custom content.

Attributes

lang

Specifies a language identifier for the scope of the current element. Language is considered a text property because it controls language specific line breaking rules, hyphenation rules and the default text directionality.

The format for this value should be the same as used for the xml:lang attribute. This format is defined in IETF FRC 1766.

Two system variables — {language} and {locale} — are set when the language is changed. See “System variables” for a description of these variables.

Example: Setting the language identifier to EN-US sets the {language} variable to en.

The following example shows how to set the current language using a language identifier in the lang attribute:

<text-properties lang="{@lang}" />
direction

Specifies the text direction. The value is one of LTR (left-to-right), RTL (right-to-left), or default (the text direction is determined by the natural direction of the current text language).

The following example shows how to set the text direction using a language identifier in the lang attribute:

<text-properties lang="{@lang}" direction="default" />
break-chars

Specifies a text string that declares a set of word break characters for the scope of the current element. The specified characters become those that can cause a natural word break in the typesetting (in addition to white space). The default word break character is a hyphen (U+002D).

The following example shows how to specify a set of word break characters that include a literal & and an — (em rule) :

<text-properties break-chars="?&amp;#=;+&#x2014;" />

The following example clears the word break character list for the scope of the current element:

<text-properties break-chars="" />
wordbreak

Specifies the line break mode. The permitted values for this property are:

  • normal — use the standard line breaking algorithm to determine a valid line break. This is the default.

  • legacy — apply the legacy line breaking algorithm to determine a valid line break.

Overriding the line breaking rules

The following <text-properties/> attributes control when TopLeaf is permitted to insert a word break after a designated word break character.

break-minlength

Specifies the length of the smallest word in which TopLeaf may insert a word break after a word break character. The default is 0, which means that a word break is permitted after any word break character.

break-minbefore

Specifies the minimum number of characters that must appear in the word before a word break character. The default is 0.

break-minafter

Specifies the minimum number of characters that must appear in the word after a word break character. The default is 0.

For example, the following command prohibits the insertion of a word break after the initial hyphen in any word beginning with a hyphen:

<text-properties break-chars="-" break-minbefore="1" />

You can also use a word joiner (U+2060) code to prevent a line break after a designated word break character. For example, if '/' (U+0024) is declared as a word break character, then the sequence /&#x2060; ensures that the character to the left and right of the '/' will be on the same line. To prevent a line break appearing after a space (U+0020), replace the space character with a non-breaking space (U+00A0).

Language specific line breaking rules

The typesetting engine uses the value of the {language} variable to determine which language specific line breaking rules are applied. The {language} variable is set from the xml:lang tag attribute or the <text-properties lang="LA" /> directive.