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 5 methods for working with Font objects in Python programs. Available methods include: convert, get_kern_pairs, save, save_to_format, to_bytes. All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package. Properties: encoding, font_family, font_name, font_style, font_type, glyph_accessor, and 2 more.

Properties

NameTypeAccessDescription
font_typeFontTypeReadGets the font type.
font_namestrReadGets the font name.
font_familystrReadGets the font family.
font_stylestrReadGets the font style.
num_glyphsintReadGets the num glyphs.
metricsFontMetricsReadGets the metrics.
encodingFontEncodingReadGets the encoding.
glyph_accessorGlyphAccessorReadGets the glyph accessor.

Methods

SignatureDescription
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

 English