AuthoredFont

Overview

AuthoredFont is a class in Aspose.PDF FOSS for Python.

A normalized embedded font and the mutable CID mapping for authored text.

This class provides 8 methods for working with AuthoredFont objects in Python programs. Available methods include: __init__, cid_to_gid_bytes, cid_widths, embedded_program, encode, encode_glyph, glyph_id, to_unicode_cmap. All public members are accessible to any Python application after installing the Aspose.PDF FOSS for Python package. Properties: base_name, cid_font_subtype, descriptor_metrics, fingerprint, font_file_key, font_file_subtype, and 3 more.

Properties

NameTypeAccessDescription
base_namestrReadReturn the exact current PDF BaseFont/FontName value.
pdf_base_namestrReadAlias for :attr:base_name used by COS integration code.
is_subsetboolReadWhether :meth:embedded_program currently returns a reduced font.
descriptor_metricsdict[str, int | float | tuple[int, int, int, int]]ReadReturn PDF FontDescriptor metrics using PDF dictionary key names.
shaping_programbytesReadReturn the complete SFNT program used by the shaping engine.
fingerprint``ReadGets the fingerprint.
cid_font_subtype``ReadGets the cid font subtype.
font_file_key``ReadGets the font file key.
font_file_subtype``ReadGets the font file subtype.

Methods

SignatureDescription
__init__(sfnt_program: bytes, embedded_program: bytes, plain_base_name: str, kind: str, unicode_to_gid: dict[int, int], metrics: _SfntMetrics, gid_to_native_cid: dict[int, int] | None)Calls init(sfnt_program, embedded_program, plain_base_name, kind, unicode_to_gid, metrics, gid_to_native_cid) on this AuthoredFont instance.
glyph_id(character: str)int | NoneReturn the cmap glyph ID for one Unicode character, if available.
encode(text: str)bytesEncode text as two-byte CIDs and extend the current font mapping.
encode_glyph(gid: int, unicode_text: str)bytesAssign a CID to one shaped glyph and its logical Unicode cluster.
embedded_program()bytesReturn the current embedded program, subset when it becomes smaller.
to_unicode_cmap()bytesBuild a ToUnicode CMap for the current two-byte CID assignments.
cid_widths()dict[int, int]Return current CID -> advance widths in 1000-unit PDF space.
cid_to_gid_bytes()bytes | NoneReturn a CIDToGIDMap stream for TrueType, or None for CFF.

See Also