com.aspose.words
Class FontConfigSubstitutionRule

java.lang.Object
  extended by FontSubstitutionRule
      extended by com.aspose.words.FontConfigSubstitutionRule

public class FontConfigSubstitutionRule 
extends FontSubstitutionRule

Font config substitution rule.

This rule uses fontconfig utility on Linux (and other Unix-like) platforms to get the substitution if the original font is not available.

If fontconfig utility is not available then this rule will be ignored.

Example:

Shows operating system-dependent font config substitution.
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution = fontSettings.getSubstitutionSettings().getFontConfigSubstitution();

// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (SystemUtils.IS_OS_WINDOWS) {
    Assert.assertFalse(fontConfigSubstitution.getEnabled());
    Assert.assertFalse(fontConfigSubstitution.isFontConfigAvailable());
}

// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (SystemUtils.IS_OS_LINUX) {
    Assert.assertTrue(fontConfigSubstitution.getEnabled());
    Assert.assertTrue(fontConfigSubstitution.isFontConfigAvailable());

    fontConfigSubstitution.resetCache();
}

Property Getters/Setters Summary
voidsetEnabled(boolean value)
           Specifies whether the rule is enabled or not.
 
Method Summary
booleanisFontConfigAvailable()
           Check if fontconfig utility is available or not.
voidresetCache()
           Resets the cache of fontconfig calling results.
 

Property Getters/Setters Detail

setEnabled

public void setEnabled(boolean value)
Specifies whether the rule is enabled or not.

Example:

Shows operating system-dependent font config substitution.
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution = fontSettings.getSubstitutionSettings().getFontConfigSubstitution();

// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (SystemUtils.IS_OS_WINDOWS) {
    Assert.assertFalse(fontConfigSubstitution.getEnabled());
    Assert.assertFalse(fontConfigSubstitution.isFontConfigAvailable());
}

// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (SystemUtils.IS_OS_LINUX) {
    Assert.assertTrue(fontConfigSubstitution.getEnabled());
    Assert.assertTrue(fontConfigSubstitution.isFontConfigAvailable());

    fontConfigSubstitution.resetCache();
}

Method Detail

isFontConfigAvailable

public boolean isFontConfigAvailable()
Check if fontconfig utility is available or not.

Example:

Shows operating system-dependent font config substitution.
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution = fontSettings.getSubstitutionSettings().getFontConfigSubstitution();

// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (SystemUtils.IS_OS_WINDOWS) {
    Assert.assertFalse(fontConfigSubstitution.getEnabled());
    Assert.assertFalse(fontConfigSubstitution.isFontConfigAvailable());
}

// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (SystemUtils.IS_OS_LINUX) {
    Assert.assertTrue(fontConfigSubstitution.getEnabled());
    Assert.assertTrue(fontConfigSubstitution.isFontConfigAvailable());

    fontConfigSubstitution.resetCache();
}

resetCache

public void resetCache()
Resets the cache of fontconfig calling results.

Example:

Shows operating system-dependent font config substitution.
FontSettings fontSettings = new FontSettings();
FontConfigSubstitutionRule fontConfigSubstitution = fontSettings.getSubstitutionSettings().getFontConfigSubstitution();

// The FontConfigSubstitutionRule object works differently on Windows/non-Windows platforms.
// On Windows, it is unavailable.
if (SystemUtils.IS_OS_WINDOWS) {
    Assert.assertFalse(fontConfigSubstitution.getEnabled());
    Assert.assertFalse(fontConfigSubstitution.isFontConfigAvailable());
}

// On Linux/Mac, we will have access to it, and will be able to perform operations.
if (SystemUtils.IS_OS_LINUX) {
    Assert.assertTrue(fontConfigSubstitution.getEnabled());
    Assert.assertTrue(fontConfigSubstitution.isFontConfigAvailable());

    fontConfigSubstitution.resetCache();
}

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.