ProcessorContext.FontSettings

ProcessorContext FontSettings property. Allows to specify document font settings.

ProcessorContext.FontSettings property

Allows to specify document font settings.

public FontSettings FontSettings { get; set; }

Remarks

When loading some formats, Wordize may require to resolve the fonts. For example, when loading HTML documents Wordize may resolve the fonts to perform font fallback.

If set to null, default static font settings DefaultFontSettings will be used.

The default value is null.

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