Woff2Font
Overview
Woff2Font is a class in Aspose.Font FOSS for Python.
Inherits from: Font.
Woff2Font.to_bytes(font_type) serializes the WOFF2 font into a bytes object for the specified font_type.
This class provides 14 methods for working with Woff2Font objects in Python programs.
Available methods include: __init__, convert, encoding, font_family, font_name, font_style, font_type, get_kern_pairs, glyph_accessor, metrics, num_glyphs, save, and 2 additional methods.
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 4 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. |
metadata_xml | str | Read | Gets the metadata xml. |
inner_font | TtfFont | Read | Gets the inner font. |
Methods
| Signature | Description |
|---|---|
__init__(inner: TtfFont, metadata_xml: str) | Calls init on this Woff2Font instance. |
get_kern_pairs() → list[KernPair] | Returns the kern pairs. |
to_bytes(font_type: FontType | None) → bytes | Serializes the WOFF2 font into a bytes object for the specified font_type |
font_type() → FontType | Returns the FontType of this Woff2Font instance |
font_name() → str | Calls font_name on this Woff2Font instance. |
font_family() → str | Property holds the font’s family name string |
font_style() → str | Property holds the font’s style descriptor string |
num_glyphs() → int | Property holds the total glyph count as an integer |
metrics() → FontMetrics | Returns a FontMetrics object containing the font’s metrics |
encoding() → FontEncoding | Property holds a FontEncoding instance describing the font’s encoding |
glyph_accessor() → GlyphAccessor | Property holds a GlyphAccessor for glyph operations |
save(path: str) | Calls save on this Woff2Font instance. |
save_to_format(font_type: FontType, path: str) | Calls save_to_format on this Woff2Font instance. |
convert(target: FontType) → Font | Returns a Font object in the requested target format, enabling conversion from a WOFF2 font to any other supported format such as TTF or OTF |