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
| Signature | Description |
|---|---|
font_type() → FontType | Returns the font’s format type as a FontType enum |
font_name() → str | Returns the full font name string |
font_family() → str | Calls font_family on this Font instance. |
font_style() → str | Calls font_style on this Font instance. |
num_glyphs() → int | Calls num_glyphs on this Font instance. |
metrics() → FontMetrics | Calls metrics on this Font instance. |
encoding() → FontEncoding | Calls encoding on this Font instance. |
glyph_accessor() → GlyphAccessor | Returns 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) → bytes | Returns 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) → Font | creates a newFontobject converted to the target format; conversion failures raiseFontConversionException` |