FontSubstitutionRule
Contents
[
Hide
]FontSubstitutionRule class
This is an abstract base class for the font substitution rule.
To learn more, visit the Working with Fonts documentation article.
public abstract class FontSubstitutionRule
Properties
Name | Description |
---|---|
virtual Enabled { get; set; } | Specifies whether the rule is enabled or not. |
Examples
Shows operating system-dependent font config substitution.
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution =
fontSettings.SubstitutionSettings.FontConfigSubstitution;
bool isWindows = new[] {PlatformID.Win32NT, PlatformID.Win32S, PlatformID.Win32Windows, PlatformID.WinCE}
.Any(p => Environment.OSVersion.Platform == p);
// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (isWindows)
{
Assert.False(fontConfigSubstitution.Enabled);
Assert.False(fontConfigSubstitution.IsFontConfigAvailable());
}
bool isLinuxOrMac =
new[] {PlatformID.Unix, PlatformID.MacOSX}.Any(p => Environment.OSVersion.Platform == p);
// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (isLinuxOrMac)
{
Assert.True(fontConfigSubstitution.Enabled);
Assert.True(fontConfigSubstitution.IsFontConfigAvailable());
fontConfigSubstitution.ResetCache();
}
See Also
- namespace Aspose.Words.Fonts
- assembly Aspose.Words