Aspose::Words::Fonts::FontInfoCollection::Contains method

FontInfoCollection::Contains method

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

bool Aspose::Words::Fonts::FontInfoCollection::Contains(const System::String &name)
ParameterTypeDescription
nameconst System::String&Case-insensitive name of the font to locate.

ReturnValue

true if the item is found in the collection; otherwise, false.

Examples

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

auto doc = MakeObject<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.
ASSERT_EQ(3, doc->get_FontInfos()->get_Count());

ASSERT_TRUE(doc->get_FontInfos()->Contains(u"Times New Roman"));
ASSERT_EQ(204, doc->get_FontInfos()->idx_get(u"Times New Roman")->get_Charset());

ASSERT_TRUE(doc->get_FontInfos()->Contains(u"Symbol"));
ASSERT_TRUE(doc->get_FontInfos()->Contains(u"Arial"));

See Also