FileFontSource

FileFontSource class

Represents the single TrueType font file stored in the file system.

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

public class FileFontSource : FontSourceBase

Constructors

NameDescription
FileFontSource(string)Ctor.
FileFontSource(string, int)Ctor.
FileFontSource(string, int, string)Ctor.

Properties

NameDescription
CacheKey { get; }The key of this source in the cache.
FilePath { get; }Path to the font file.
Priority { get; }Returns the font source priority.
override 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