FontSubstitutionSettings.TableSubstitution
FontSubstitutionSettings TableSubstitution property. Settings related to table substitution rule.
FontSubstitutionSettings.TableSubstitution property
Settings related to table substitution rule.
public TableSubstitutionRule TableSubstitution { get; }
Examples
Shows how to configure table substitution rule.
FontSettings fontSettings = new FontSettings();
// Add substitutions for Arial font
fontSettings.SubstitutionSettings.TableSubstitution.AddSubstitutes("Arial", "Times New Roman", "FangSong");
fontSettings.SubstitutionSettings.TableSubstitution.AddSubstitutes("Arial", "Courier New");
// Get substitutions for Arial.
IEnumerable<string> substitutes = fontSettings.SubstitutionSettings.TableSubstitution.GetSubstitutes("Arial");
bool isWindows = new[] { PlatformID.Win32NT, PlatformID.Win32S, PlatformID.Win32Windows, PlatformID.WinCE }
.Any(p => Environment.OSVersion.Platform == p);
// Different TableSubstitution rules are loaded on Windows and Linux. Arial is a standard font
// on Windows, so there are no default Arial substitutions on Windows.
if (isWindows)
Assert.That(substitutes.Count(), Is.EqualTo(3));
bool isLinux = new[] { PlatformID.Unix }.Any(p => Environment.OSVersion.Platform == p);
// On Linux, there are predefined default Arial substitution rules, and our rules are added to them.
if (isLinux)
Assert.That(substitutes.Count(), Is.EqualTo(7));
// Override substitutions for Arial font
fontSettings.SubstitutionSettings.TableSubstitution.SetSubstitutes("Arial", "Times New Roman");
substitutes = fontSettings.SubstitutionSettings.TableSubstitution.GetSubstitutes("Arial");
Assert.That(substitutes.Count(), Is.EqualTo(1));
See Also
- class TableSubstitutionRule
- class FontSubstitutionSettings
- namespace Wordize.Fonts
- assembly Wordize