default_instance property

FontSettings.default_instance property

Static default font settings.

@property
def default_instance(self) -> aspose.words.fonts.FontSettings:
    ...

Remarks

This instance is used by default in a document unless Document.font_settings is specified.

Examples

Shows how to configure the default font settings instance.

# Configure the default font settings instance to use the "Courier New" font
# as a backup substitute when we attempt to use an unknown font.
aw.fonts.FontSettings.default_instance.substitution_settings.default_font_substitution.default_font_name = 'Courier New'
self.assertTrue(aw.fonts.FontSettings.default_instance.substitution_settings.default_font_substitution.enabled)
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.font.name = 'Non-existent font'
builder.write('Hello world!')
# This document does not have a FontSettings configuration. When we render the document,
# the default FontSettings instance will resolve the missing font.
# Aspose.Words will use "Courier New" to render text that uses the unknown font.
self.assertIsNone(doc.font_settings)
doc.save(file_name=ARTIFACTS_DIR + 'FontSettings.DefaultFontInstance.pdf')

See Also