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
| Name | Type | Access | Description |
|---|---|---|---|
font_type | FontType | Read | Gets the font type. |
font_name | str | Read | Gets the font name. |
font_family | str | Read | Gets the font family. |
font_style | str | Read | Gets the font style. |
num_glyphs | int | Read | Gets the num glyphs. |
metrics | FontMetrics | Read | Gets the metrics. |
encoding | FontEncoding | Read | Gets the encoding. |
glyph_accessor | GlyphAccessor | Read | Gets the glyph accessor. |
Methods
| Signature | Description |
|---|---|
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` |