Font

Overview

Font is a class in Aspose.Font FOSS for Python. Inherits from: ABC.

Abstract base for all font format implementations.

This class provides 13 methods for working with Font objects in Python programs. Available methods include: convert, encoding, font_family, font_name, font_style, font_type, get_kern_pairs, glyph_accessor, metrics, num_glyphs, save, save_to_format, and 1 additional methods. All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package.

Methods

SignatureDescription
font_type()FontTypeReturns the font’s format type as a FontType enum
font_name()strReturns the full font name string
font_family()strCalls font_family on this Font instance.
font_style()strCalls font_style on this Font instance.
num_glyphs()intCalls num_glyphs on this Font instance.
metrics()FontMetricsCalls metrics on this Font instance.
encoding()FontEncodingCalls encoding on this Font instance.
glyph_accessor()GlyphAccessorReturns a GlyphAccessor for accessing individual glyphs
save(path: str)Writes the current font instance to the given filesystem path, preserving its current format
to_bytes(font_type: FontType | None)bytesReturns the binary representation of the font in the specified FontType, enabling in‑memory export
save_to_format(font_type: FontType, path: str)Writes the font in the given FontType to the specified path
get_kern_pairs()list[KernPair]Return all kern pairs for this font.
convert(target: FontType)Fontcreates a newFontobject converted to the target format; conversion failures raiseFontConversionException`

See Also