SystemFontResolver Class

Definition

The operating system's installed fonts as a font resolver: the font resolver every engine asks last, unless replaced or turned off with UseSystemFontResolver(IFontResolver?).

public sealed class SystemFontResolver : IFontResolver

Remarks

ISO 32000-2 §9.6.2.1 (Table 109: BaseFont "may be used to find the font program in the PDF processor or its environment"), §9.6.2.2 and §9.8. The font directories are read in managed code (no fontconfig, CoreText or DirectWrite): TrueType and OpenType files and collections (.ttf, .otf, .ttc, .otc), headers only, each at most once per instance. The engines' default instance is shared by the process.

The first font asked for does not wait for every font file to be read: the directories are listed (names only), and a font is looked for first in the files whose names share their first three letters with the name, family or stand-ins asked for (Arial Bold.ttf, arialbd.ttf for Arial), and in files whose names say nothing about their family (non-Latin names); only when those hold nothing for it are the other files read. An index file (IndexPath, off by default; for the engines' default instance SystemFontIndexPath) keeps what was read for later processes.

A font is looked for, in order: by PostScript name ignoring case (also without hyphens, with the Windows Name,Style comma read as a hyphen, and with -Regular), Exact; by family and style, the family taken from the name with style words removed or from the descriptor's FontFamily, compared with the fonts' typographic and legacy family names, Family; and for a Standard 14 font, through the fonts that usually stand in for it (Helvetica: Helvetica, Arial, Liberation Sans, Arimo, Nimbus Sans, TeX Gyre Heros, FreeSans; Times: Times, Times New Roman, Liberation Serif, Tinos, Nimbus Roman, TeX Gyre Termes, FreeSerif; Courier: Courier, Courier New, Liberation Mono, Cousine, Nimbus Mono, TeX Gyre Cursor, FreeMono; Symbol: Symbol, Standard Symbols PS; ZapfDingbats: ZapfDingbats, Dingbats, D050000L, never Wingdings), Standard14. Among the faces of a family, the one closest in weight, slope and width wins; ties go to the first in directory order.

The directories: on Windows, the Fonts folder and the per-user %LOCALAPPDATA%\Microsoft\Windows\Fonts; on macOS, /System/Library/Fonts (with Supplemental), /Library/Fonts, ~/Library/Fonts and /Network/Library/Fonts; on iOS and Mac Catalyst, /System/Library/Fonts; on Android, /system/fonts, /product/fonts and /system/product/fonts; elsewhere (Linux, FreeBSD), $XDG_DATA_HOME/fonts, ~/.fonts, each $XDG_DATA_DIRS entry's fonts and /usr/X11R6/lib/X11/fonts; in the browser, none.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Constructors (3)

Properties (2)

Methods (1)