FontConfigSubstitutionRuleResetCache Method

Resets the cache of fontconfig calling results.

Namespace:  Aspose.Words.Fonts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public void ResetCache()
Examples
Shows OS-dependent font config substitution.
// Create a new FontSettings object and get its font config substitution rule
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution = fontSettings.SubstitutionSettings.FontConfigSubstitution;

// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms
// On Windows, it is unavailable
PlatformID pid = Environment.OSVersion.Platform;
bool isWindows = pid == PlatformID.Win32NT || pid == PlatformID.Win32S || pid == PlatformID.Win32Windows || pid == PlatformID.WinCE;

if (isWindows)
{
    Assert.False(fontConfigSubstitution.Enabled);
    Assert.False(fontConfigSubstitution.IsFontConfigAvailable());
}

// On Linux/Mac, we will have access and will be able to perform operations
bool isLinuxOrMac = pid == PlatformID.Unix || pid == PlatformID.MacOSX;

if (isLinuxOrMac)
{
    Assert.True(fontConfigSubstitution.Enabled);
    Assert.True(fontConfigSubstitution.IsFontConfigAvailable());

    fontConfigSubstitution.ResetCache();
}
See Also