FontSubstitutionSettings Class
FontSubstitutionSettings class
Specifies font substitution mechanism settings.
public class FontSubstitutionSettings
Properties
Name | Description |
---|---|
DefaultFontSubstitution { get; } | Settings related to default font substitution rule. |
FontConfigSubstitution { get; } | Settings related to font config substitution rule. |
FontInfoSubstitution { get; } | Settings related to font info substitution rule. |
FontNameSubstitution { get; } | Settings related to font name substitution rule. |
TableSubstitution { get; } | Settings related to table substitution rule. |
Remarks
Font substitution process consists of several rules which are checked one by one in specific order. If the first rule can’t resolve the font then second rule is checked and so on.
The order of the rules is following: 1. Font name substitution rule (enabled by default) 2. Font config substitution rule (disabled by default) 3. Table substitution rule (enabled by default) 4. Font info substitution rule (enabled by default) 5. Default font rule (enabled by default)
Note that font info substitution rule will always resolve the font if font info is available and will override the default font rule. If you want to use the default font rule then you should disable the font info substitution rule.
Note that font config substitution rule will resolve the font in most cases and thus overrides all other rules.
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
- namespace Wordize.Fonts
- assembly Wordize