com.aspose.words

Class DefaultFontSubstitutionRule

public class DefaultFontSubstitutionRule 
extends FontSubstitutionRule

Default font substitution rule.
This rule defines single default font name to be used for substitution if the original font is not available.

Property Getters/Setters Summary
java.lang.StringgetDefaultFontName()
void
setDefaultFontName(java.lang.Stringvalue)
           Gets or sets the default font name.
booleangetEnabled()
void
setEnabled(booleanvalue)
           Specifies whether the rule is enabled or not.
 

    • Property Getters/Setters Detail

      • getDefaultFontName/setDefaultFontName

        public java.lang.String getDefaultFontName() / public void setDefaultFontName(java.lang.String value)
        
        Gets or sets the default font name.

        The default value is 'Times New Roman'.

        Example:

        Demonstrates how to specify what font to substitute for a missing font during rendering.
        Document doc = new Document(getMyDir() + "Rendering.docx");
        
        // If the default font defined here cannot be found during rendering then the closest font on the machine is used instead
        FontSettings.getDefaultInstance().getSubstitutionSettings().getDefaultFontSubstitution().setDefaultFontName("Arial Unicode MS");
        
        // Now the set default font is used in place of any missing fonts during any rendering calls
        doc.save(getArtifactsDir() + "Rendering.SetDefaultFontName.pdf");
        doc.save(getArtifactsDir() + "Rendering.SetDefaultFontName.xps");
      • getEnabled/setEnabled

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