Type1Font

Overview

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

Type1Font.load_afm loads an AFM file from the given path into the Type1Font instance.

This class provides 15 methods for working with Type1Font objects in Python programs. Available methods include: __init__, convert, encoding, font_family, font_name, font_style, font_type, get_kern_pairs, glyph_accessor, load_afm, metrics, num_glyphs, and 3 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 2 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.

Methods

SignatureDescription
__init__(raw_data: bytes, font_data: Type1FontData, is_pfa: bool)Calls init on this Type1Font instance.
get_kern_pairs()list[KernPair]Returns the kern pairs.
load_afm(path: str)Loads an AFM file from the given path into the Type1Font instance
to_bytes(font_type: FontType | None)bytesSerializes the font to bytes, optionally using the specified FontType
font_type()FontTypeReturns the FontType enum value that identifies the font’s format
font_name()strCalls font_name on this Type1Font instance.
font_family()strProperty stores the family name of the font
font_style()strReturns the style descriptor (e.g., Bold, Italic) of the font
num_glyphs()intProperty gives the total count of glyphs in the font
metrics()FontMetricsProperty provides access to the FontMetrics object for the font
encoding()FontEncodingReturns a FontEncoding object that describes the font’s character encoding
glyph_accessor()GlyphAccessorReturns a GlyphAccessor for retrieving glyph data from the font
save(path: str)Writes the font to the specified file path in its current format
save_to_format(font_type: FontType, path: str)Saves the font converted to the given FontType at the provided path
convert(target: FontType)FontCalls convert on this Type1Font instance.

See Also