FolderFontSource Class
Wordize.Fonts.FolderFontSource class. Represents the folder that contains TrueType font files.
FolderFontSource class
Represents the folder that contains TrueType font files.
public class FolderFontSource : FontSourceBase
Constructors
Name | Description |
---|---|
FolderFontSource(string, bool) | Ctor. |
FolderFontSource(string, bool, int) | Ctor. |
Properties
Name | Description |
---|---|
FolderPath { get; } | Path to the folder. |
Priority { get; } | Returns the font source priority. |
ScanSubfolders { get; } | Determines whether or not to scan the subfolders. |
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
Name | Description |
---|---|
GetAvailableFonts() | Returns list of fonts available via this source. |
Examples
Implementation of IWarningCallback to display warnings generated when reading font sources.
private class FontReadingWarningCallback : IWarningCallback
{
public void Warning(WarningInfo info)
{
if (info.Source == WarningSource.Font)
{
Console.WriteLine(info.Description);
}
}
}
Demonstrates how to specify multiple font sources and generate warnings when reading fonts from these sources.
IWarningCallback fontReadingWarningCallback = new FontReadingWarningCallback();
FolderFontSource firstSource = new FolderFontSource(MyDir + "MyFonts", true);
firstSource.WarningCallback = fontReadingWarningCallback;
FolderFontSource secondSource = new FolderFontSource(MyDir + "MyFonts2", true);
secondSource.WarningCallback = fontReadingWarningCallback;
// Specify font setting for concrete document conversion operation.
ConverterContext context = new ConverterContext();
context.FontSettings = new FontSettings();
context.FontSettings.SetFontsSources(new FontSourceBase[] { firstSource, secondSource });
Converter.Create(context)
.From(MyDir + "Simple.docx")
.To(ArtifactsDir + "FontSubstitution.pdf")
.Execute();
See Also
- class FontSourceBase
- namespace Wordize.Fonts
- assembly Wordize