contains method

contains(name)

Determines whether the collection contains a font with the given name.

def contains(self, name: str):
    ...
ParameterTypeDescription
namestrCase-insensitive name of the font to locate.

Returns

True if the item is found in the collection; otherwise, False.

Examples

Shows info about the fonts that are present in the blank document.

doc = aw.Document()
# A blank document contains 3 default fonts. Each font in the document
# will have a corresponding FontInfo object which contains details about that font.
self.assertEqual(3, doc.font_infos.count)
self.assertTrue(doc.font_infos.contains('Times New Roman'))
self.assertEqual(204, doc.font_infos.get_by_name('Times New Roman').charset)
self.assertTrue(doc.font_infos.contains('Symbol'))
self.assertTrue(doc.font_infos.contains('Arial'))

See Also