Aspose::Words::Fonts::FontInfo class

FontInfo class

Specifies information about a font used in the document. To learn more, visit the Working with Fonts documentation article.

class FontInfo : public System::Object

Methods

MethodDescription
get_AltName() constGets or sets the alternate name for the font.
get_Charset()Gets or sets the character set for the font.
get_EmbeddingLicensingRights()
get_Family() constGets or sets the font family this font belongs to.
get_IsTrueType() constIndicates that this font is a TrueType or OpenType font as opposed to a raster or vector font. Default is true.
get_Name() constGets the name of the font.
get_Panose() constGets or sets the PANOSE typeface classification number.
get_Pitch() constThe pitch indicates if the font is fixed pitch, proportionally spaced, or relies on a default setting.
GetEmbeddedFont(Aspose::Words::Fonts::EmbeddedFontFormat, Aspose::Words::Fonts::EmbeddedFontStyle)Gets a specific embedded font file.
GetEmbeddedFontAsOpenType(Aspose::Words::Fonts::EmbeddedFontStyle)Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType.
GetType() const override
Is(const System::TypeInfo&) const override
set_AltName(const System::String&)Setter for Aspose::Words::Fonts::FontInfo::get_AltName.
set_Charset(int32_t)Setter for Aspose::Words::Fonts::FontInfo::get_Charset.
set_Family(Aspose::Words::Fonts::FontFamily)Setter for Aspose::Words::Fonts::FontInfo::get_Family.
set_IsTrueType(bool)Setter for Aspose::Words::Fonts::FontInfo::get_IsTrueType.
set_Panose(const System::ArrayPtr<uint8_t>&)Setter for Aspose::Words::Fonts::FontInfo::get_Panose.
set_Pitch(Aspose::Words::Fonts::FontPitch)Setter for Aspose::Words::Fonts::FontInfo::get_Pitch.
static Type()

Remarks

You do not create instances of this class directly. Use the FontInfos property to access the collection of fonts defined in a document.

Examples

Shows how to print the details of what fonts are present in a document.

auto doc = MakeObject<Document>(MyDir + u"Embedded font.docx");

SharedPtr<Aspose::Words::Fonts::FontInfoCollection> allFonts = doc->get_FontInfos();

// Print all the used and unused fonts in the document.
for (int i = 0; i < allFonts->get_Count(); i++)
{
    std::cout << "Font index #" << i << std::endl;
    std::cout << "\tName: " << allFonts->idx_get(i)->get_Name() << std::endl;
    std::cout << "\tIs " << (allFonts->idx_get(i)->get_IsTrueType() ? String(u"") : String(u"not ")) << "a trueType font" << std::endl;
}

See Also