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

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.
metadata_xmlstrReadGets the metadata xml.
inner_fontTtfFontReadGets the inner font.

Methods

SignatureDescription
__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)bytesSerializes the WOFF2 font into a bytes object for the specified font_type
font_type()FontTypeReturns the FontType of this Woff2Font instance
font_name()strCalls font_name on this Woff2Font instance.
font_family()strProperty holds the font’s family name string
font_style()strProperty holds the font’s style descriptor string
num_glyphs()intProperty holds the total glyph count as an integer
metrics()FontMetricsReturns a FontMetrics object containing the font’s metrics
encoding()FontEncodingProperty holds a FontEncoding instance describing the font’s encoding
glyph_accessor()GlyphAccessorProperty 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)FontReturns a Font object in the requested target format, enabling conversion from a WOFF2 font to any other supported format such as TTF or OTF

See Also