FontNameSubstitutionRule Class

Wordize.Fonts.FontNameSubstitutionRule class. Font substitution rule for processing font name.

FontNameSubstitutionRule class

Font substitution rule for processing font name.

public class FontNameSubstitutionRule : FontSubstitutionRule

Properties

NameDescription
Enabled { get; set; }Specifies whether the rule is enabled or not.

Remarks

According to this rule Wordize tries to process the font name to get the substitution. Particularly Wordize tries to removes suffixes with ‘-’, ‘,’ and ‘(’ separators like it does the MS Word.

Examples

Shows how to enable and disable font substitution rules. Demonstrates how to specify default substitution font.

FontSettings fontSettings = new FontSettings();
fontSettings.SetFontsFolder(MyDir + "MyFonts", true);

// Disable font name substitution rule, which is enabled by default
fontSettings.SubstitutionSettings.FontNameSubstitution.Enabled = false;
// Disable font config substitution rule, which is disabled by default
fontSettings.SubstitutionSettings.FontConfigSubstitution.Enabled = false;
// Disable table substitution rule, which is enabled by default
fontSettings.SubstitutionSettings.TableSubstitution.Enabled = false;
// Disable font info substitution rule, which is enabled by default
fontSettings.SubstitutionSettings.FontInfoSubstitution.Enabled = false;
// Enable default font rule, which is enabled by default
fontSettings.SubstitutionSettings.DefaultFontSubstitution.Enabled = true;
fontSettings.SubstitutionSettings.DefaultFontSubstitution.DefaultFontName = "Noticia Text";

// Specify font setting for concrete document conversion operation.
ConverterContext context = new ConverterContext();
context.FontSettings = fontSettings;

// Missed fonts will be substituted with default "Noticia Text" font if it is available.
Converter.Create(context)
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "FontSubstitutionNoticiaText.pdf")
    .Execute();

See Also