TableSubstitutionRule.GetSubstitutes
TableSubstitutionRule GetSubstitutes method. Returns array containing substitute font names for the specified original font name.
TableSubstitutionRule.GetSubstitutes method
Returns array containing substitute font names for the specified original font name.
public IEnumerable<string> GetSubstitutes(string originalFontName)
| Parameter | Type | Description |
|---|---|---|
| originalFontName | String | Original font name. |
Return Value
List of alternative font names.
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
- namespace Wordize.Fonts
- assembly Wordize