CffFont

Overview

CffFont is a class in Aspose.Font FOSS for Python. Inherits from: Font.

CffFont.get_kern_pairs() returns a list of KernPair objects representing the kerning adjustments defined in the font.

This class provides 14 methods for working with CffFont 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: charset, charstrings, encoding, font_family, font_name, font_style, and 9 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.
encoding``ReadGets the encoding.
glyph_accessorGlyphAccessorReadGets the glyph accessor.
top_dictTopDictReadGets the top dict.
private_dictPrivateDictReadGets the private dict.
charstringsCffIndexReadGets the charstrings.
global_subrsCffIndexReadGets the global subrs.
local_subrsCffIndexReadGets the local subrs.
charsetCffCharsetReadGets the charset.
string_indexCffIndexReadGets the string index.

Methods

SignatureDescription
__init__(data: bytes, top_dict: TopDict, private_dict: PrivateDict, charset: CffCharset, encoding: CffEncoding, charstrings: CffIndex, global_subrs: CffIndex, local_subrs: CffIndex, string_index: CffIndex)Calls init on this CffFont instance.
get_kern_pairs()list[KernPair]Returns the kern pairs.
to_bytes(font_type: FontType | None)bytesSerializes the font into a byte string of the specified font_type, enabling export to another format
font_type()FontTypeProperty provides the FontType of the CFF font
font_name()strReturns the font’s name string
font_family()strReturns the family name of the font
font_style()strReturns the style descriptor (e.g., Regular, Bold)
num_glyphs()intReturns the total number of glyphs in the font
metrics()FontMetricsReturns a FontMetrics object containing the font’s metric data
encoding()FontEncodingReturns a FontEncoding object describing the font’s character encoding
glyph_accessor()GlyphAccessorReturns a GlyphAccessor for accessing individual glyph data
save(path: str)Writes the font to the specified filesystem path
save_to_format(font_type: FontType, path: str)Saves the font in the given FontType to the provided path
convert(target: FontType)FontReturns a new Font object instantiated in the requested target format, enabling in‑memory format conversion before saving

See Also