Table of Contents

Class TypefaceLibrary

Namespace
Rustaveli.Pdf
Assembly
Rustaveli.Pdf.dll

The typefaces documents are set in: those registered here, then those installed on the machine.

public sealed class TypefaceLibrary
Inheritance
TypefaceLibrary
Inherited Members
Extension Methods

Remarks

A registered typeface shadows an installed one of the same name entirely, so a document whose typefaces are all registered comes out the same on every machine. Shared serves any export given no library of its own; a library created with includeInstalled: false sees only what is registered with it.

Text is set in the face nearest its style's weight and slant. A character that face lacks is set in the first of the Fallbacks that has it, then any registered face, then any installed one. Only the glyphs a document uses are embedded.

Safe for concurrent use. A document already exporting keeps the typefaces it started with.

Constructors

TypefaceLibrary()

A library of the installed typefaces, to which more can be registered.

public TypefaceLibrary()

TypefaceLibrary(bool)

A library that sees installed typefaces only when includeInstalled is set.

public TypefaceLibrary(bool includeInstalled)

Parameters

includeInstalled bool

Properties

Fallbacks

Typefaces tried in order for a character a run's own typeface lacks, before the registered and installed ones. Naming them makes the choice the same on every machine.

public IReadOnlyList<string> Fallbacks { get; set; }

Property Value

IReadOnlyList<string>

Shared

The library used by any export that names none.

public static TypefaceLibrary Shared { get; }

Property Value

TypefaceLibrary

Methods

Register(byte[], string?)

Registers every face in a font file: TrueType or OpenType, single or a collection.

public void Register(byte[] data, string? typeface = null)

Parameters

data byte[]

The font file.

typeface string

A typeface name to register it under besides its own, as a style names it; its faces keep their own weights and slants.

Exceptions

ArgumentException

The data is not a font this library can read.

Register(Stream, string?)

Registers every face in a font read from stream, which is read to its end.

public void Register(Stream stream, string? typeface = null)

Parameters

stream Stream

The font file.

typeface string

A typeface name to register it under besides its own.

Exceptions

ArgumentException

The stream does not hold a font this library can read.

RegisterFile(string, string?)

Registers every face in the font file at path.

public void RegisterFile(string path, string? typeface = null)

Parameters

path string

The font file.

typeface string

A typeface name to register it under besides its own.

Exceptions

ArgumentException

The file is not a font this library can read.

RegisterResource(Assembly, string, string?)

Registers every face in a font embedded in assembly as a manifest resource.

public void RegisterResource(Assembly assembly, string resource, string? typeface = null)

Parameters

assembly Assembly

The assembly the font is embedded in.

resource string

The resource's full name, as Assembly.GetManifestResourceNames lists it.

typeface string

A typeface name to register it under besides its own.

Exceptions

ArgumentException

The assembly has no such resource, or it is not a font this library can read.

SearchFolder(string)

Searches a folder, and the folders inside it, for typefaces as installed ones are searched: after the registered typefaces and before the installed ones, each read in full only once a document uses it.

public void SearchFolder(string path)

Parameters

path string

The folder; one that is missing or cannot be read adds nothing.