FontSourceBase

FontSourceBase class

This is an abstract base class for the classes that allow the user to specify various font sources.

To learn more, visit the Working with Fonts documentation article.

public abstract class FontSourceBase

Properties

NameDescription
Priority { get; }Returns the font source priority.
abstract Type { get; }Returns the type of the font source.
WarningCallback { get; set; }Called during processing of font source when an issue is detected that might result in formatting fidelity loss.

Methods

NameDescription
GetAvailableFonts()Returns list of fonts available via this source.

Examples

Shows how to use a font file in the local file system as a font source.

FileFontSource fileFontSource = new FileFontSource(MyDir + "Alte DIN 1451 Mittelschrift.ttf", 0);

Document doc = new Document();
doc.FontSettings = new FontSettings();
doc.FontSettings.SetFontsSources(new FontSourceBase[] {fileFontSource});

Assert.AreEqual(MyDir + "Alte DIN 1451 Mittelschrift.ttf", fileFontSource.FilePath);
Assert.AreEqual(FontSourceType.FontFile, fileFontSource.Type);
Assert.AreEqual(0, fileFontSource.Priority);

See Also