FontInfo class
FontInfo class
Specifies information about a font used in the document. To learn more, visit the Working with Fonts documentation article.
Remarks
You do not create instances of this class directly. Use the DocumentBase.font_infos property to access the collection of fonts defined in a document.
Properties
Name | Description |
---|---|
alt_name | Gets or sets the alternate name for the font. |
charset | Gets or sets the character set for the font. |
family | Gets or sets the font family this font belongs to. |
is_true_type | Indicates that this font is a TrueType or OpenType font as opposed to a raster or vector font. Default is True . |
name | Gets the name of the font. |
panose | Gets or sets the PANOSE typeface classification number. |
pitch | The pitch indicates if the font is fixed pitch, proportionally spaced, or relies on a default setting. |
Methods
Name | Description |
---|---|
get_embedded_font(format, style) | Gets a specific embedded font file. |
get_embedded_font_as_open_type(style) | Gets an embedded font file in OpenType format. Fonts in Embedded OpenType format are converted to OpenType. |
Examples
Shows how to print the details of what fonts are present in a document.
doc = aw.Document(MY_DIR + "Embedded font.docx")
all_fonts = doc.font_infos
# Print all the used and unused fonts in the document.
for i in range(all_fonts.count):
print(f"Font index #{i}")
print(f"\tName: {all_fonts[i].name}")
print(f'\tIs {"" if all_fonts[i].is_true_type else "not "}a TrueType font')
See Also
- module aspose.words.fonts
- class FontInfoCollection
- property DocumentBase.font_infos