LoadFontfile

Load a font file (.otf, .ttf, .pfb) and associate it with an internal name. If a glyph is not found in the font file, an error will be raised (this can be configured via the Options command). You can specify fallbacks as a child element of Loadfontfile.

Child elements

Fallback

Parent elements

Case, ForAll, Include, Layout, Loop, Otherwise, Until, While

Attributes

features (text, optional, since version 3.9.29)

A comma separated list of OpenType features, such as +liga,-kern

filename (text)

The name (with extension) of the font file.

marginprotrusion (0 up to 100, optional)

The amount of protrusion glyphs like -, . and - stick into the right margin. Highly font dependent. Defaults to 0.

mode (optional, since version 3.9.29)

Set the shaping mode of the font. Defaults to harfbuzz.

fontforge

The old and well tested font handler. Renders western scripts well, but no right-to-left or other complex scripts.

harfbuzz

The new renderer that will eventually handle all scripts including right-to-left.

name (text)

The internal name of the font file. To be used within DefineFontfamily.

oldstylefigures (optional)

Use oldstyle figures if the font includes them. (OpenType feature »onum«)

yes

Use oldstyle figures.

no

Use lining figures.

shrink (number, optional, since version 4.19.17)

Set the maximum shrinkage factor of the fonts. Default is disabled. Values divided by 10 = percent. For example 20 means shrink by maxium of 2%.

smallcaps (optional)

Use small caps glyphs when the font supplies them.

yes

Use small caps for this font.

no

Don’t switch to small caps (default).

space (0 up to 100, optional)

The natural width between words. Can be stretched by 30% and shrunk by 10%. Defaults to 25. The value is a percentile of the font size.

step (number, optional, since version 4.19.17)

Set the step values for shrinkage / stretching. Value divided by 10 is step in percentage. For example: a value of 20 means increase / decrease size in 2% steps. Default 10.

stretch (number, optional, since version 4.19.17)

Set the maximum stretch factor of the fonts. Default is disabled. Values divided by 10 = percent. For example 20 means stretch by maxium of 2%.

Example

Info

The fonts are optionally taken from the local search path. On Windows the path %WINDIR%\Fonts (usually C:\Windows\Fonts) and on Mac OS X the paths /Library/Fonts and /System/Library/Fonts can be used as fallbacks for fonts. This can be configured with the setting fontpath.

See also

Command <DefineFontfamily>, chapter Using fonts.