warning_callback property

FontSourceBase.warning_callback property

Called during processing of font source when an issue is detected that might result in formatting fidelity loss.

@property
def warning_callback(self) -> aspose.words.IWarningCallback:
    ...

@warning_callback.setter
def warning_callback(self, value: aspose.words.IWarningCallback):
    ...

Examples

Shows how to call warning callback when the font sources working with.

settings = aw.fonts.FontSettings()
settings.set_fonts_folder('bad folder?', False)
source = settings.get_fonts_sources()[0]
callback = self.FontSourceWarningCollector()
source.warning_callback = callback
# Get the list of fonts to call warning callback.
font_infos = source.get_available_fonts()
self.assertTrue('Error loading font from the folder "bad folder?"' in callback.font_substitution_warnings[0].description)

Shows how to call warning callback when the font sources working with (FontSourceWarningCollector).

class FontSourceWarningCollector(aw.IWarningCallback):

    def __init__(self):
        self.font_substitution_warnings = aw.WarningInfoCollection()

    def warning(self, info):
        self.font_substitution_warnings.warning(info)

See Also