Aspose.Font FOSS for Python

API reference for Aspose.Font FOSS for Python v1.0.0. 139 public types organized by module.

Core API

ClassDescription
ActiveTupleSummaryActiveTupleSummary.to_dict() returns a dictionary containing the tuple’s index, scalar value, peak coordinates, start coordinates, and end coordinates.
AnimationAssetAnimationAsset.write_to(path) writes the generated animation data to the given filesystem location, creates missing parent directories, and returns the Path of the written file.
AnimationFramePackageAnimationFramePackage.write_to(path) writes the storyboard image, each frame image, and a JSON manifest describing fps and frame labels to the specified directory.
AnimationPresetAnimationPreset.name stores the identifier of the animation preset.
AnimationPreviewBuilderAnimationPreviewBuilder.available_presets returns a tuple of preset names for animation generation.
AnimationReviewPackageAnimationReviewPackage.write_to saves the review package to the given filesystem path and returns the Path.
AnimationShowcasePackageAnimationShowcasePackage.write_to writes the package to the given path and returns the resulting Path.
AnimationStepAnimationStep.coordinates stores a mapping of axis names to float values defining the font instance.
BinaryReaderWraps a byte source in seekable BytesIO for big-endian font binary parsing.
BinaryWriterAccumulates bytes for binary font serialization.
CffSerializerCffSerializer can serialize a fully populated CffFont into a byte array suitable for writing out as a CFF or OpenType font file.
ClosePathClass extending PathCommand.
CompatibilityCheckerCompatibilityChecker.compare_fonts(before, after, before_label, after_label, codepoints, text) produces a CompatibilityReport that can be exported to JSON via report.to_json(indent=2, sort_keys=True).
CompatibilityReportCompatibilityReport.to_json(indent, sort_keys) returns a JSON string of the report, and write_json(target, indent, sort_keys) writes that JSON directly to a file.
CompletedTaskRecordCompletedTaskRecord.task_id uniquely identifies the completed task.
CompositeComponentMovementCompositeComponentMovement.to_dict returns a dict of the object’s numeric and boolean fields.
CompositeGlyphComponentCompositeGlyphComponent.to_dict() returns a dict of the component’s numeric attributes.
CoverageGroupCoverage diagnostics for one request source such as a preset, text, or range.
CurveAdapterCurveAdapter.quad_to_cubic converts a quadratic Bézier (p0, q, p3) to an equivalent cubic Bézier, returning four points.
CurveToCurveTo.x1 is the x‑coordinate of the first Bézier control point.
DeltaInspectorDeltaInspector enables detailed variable‑font delta analysis, generating GlyphDeltaReport and TextDeltaReport objects that highlight coordinate changes across instances.
DeltaPointDeltaPoint.to_dict returns a dictionary of the point’s numeric components.
DeltaTupleReportDeltaTupleReport.tuple_index is the zero‑based index of the delta tuple.
EotSerializerEotSerializer.serialize(font) returns the complete binary representation of an EOT font ready for file output.
FamilyReviewExportPackageFamilyReviewExportPackage.write_to(directory) creates a set of HTML, CSS, and manifest files for a font family, returning the list of generated file paths.
FontAbstract base for all font format implementations.
FontCleanerFont metadata and technical table cleaner.
FontConversionExceptionRaised when font format conversion fails or is not supported.
FontConverterFontConverter.convert(font, target) produces a new Font object in the target format, raising FontConversionException if the conversion cannot be performed.
FontEncodingMaps Unicode codepoints to glyph IDs.
FontExceptionBase class for all font library exceptions.
FontLoaderFontLoader.open(source, font_type, collection_index) returns a Font object representing the requested font type without fully loading the entire file into memory.
FontMetricsFontMetrics exposes key typographic values such as units_per_em, ascender, descender, and line_gap for layout calculations.
FontNotSupportedExceptionRaised for valid but unsupported font features (e.g.
FontParseExceptionRaised when binary font data cannot be parsed.
FontPreviewBuilderFontPreviewBuilder.build(font, text, size, color, background, padding, antialias, file_stem, instance_coordinates, instance_name, output_format) generates a PreviewImage (PNG or SVG) of the supplied text rendered with the given font.
FontSourceInfoDescribe the origin of loaded bytes.
FontSubsetterFontSubsetter.available_presets() returns a tuple of preset names that can be used for web‑oriented subsetting.
GlyphGlyph.glyph_id identifies the glyph using its numeric GlyphId.
GlyphAccessorRetrieves glyphs by ID or Unicode codepoint.
GlyphCompatibilityIssueGlyphCompatibilityIssue.to_dict returns a dictionary representation of the issue.
GlyphDeltaComparisonReportGlyphDeltaComparisonReport.moved_point_count is the count of points that moved between before and after.
GlyphDeltaReportGlyphDeltaReport.to_dict returns a dictionary representation of the report’s data.
GlyphIdGlyphId.value holds the integer identifier of a glyph.
GlyphInterpolationIssueGlyphInterpolationIssue.codepoint is the integer Unicode codepoint of the affected glyph.
GlyphLayoutA single glyph positioned in world-space layout coordinates.
GlyphNotFoundExceptionRaised when a requested glyph ID or codepoint has no mapping in the font.
GlyphOutlineStatsGlyphOutlineStats.to_dict returns a dictionary representation of the outline statistics.
GlyphPathOrdered sequence of PathCommand objects representing one glyph’s outline.
KernPairKernPair.left is the GlyphId of the left glyph in the kerning pair.
LanguageProfileLanguageProfile.to_dict returns a dictionary representation of the language profile.
LineToLineTo.x represents the horizontal coordinate of the line endpoint.
LoadedFontFriendly loader result that wraps a font plus source metadata.
LocalizationCoverageLocalizationCoverage.to_dict returns a dictionary representation of the coverage data.
LocalizationResolutionLocalizationResolution.to_dict returns a dictionary representation of the resolution state.
MoveToMoveTo.x stores the horizontal coordinate for the move operation.
PathCommandAbstract marker for all path command types.
PreviewImagePreviewImage.write_to(path) saves the generated PNG or SVG preview to the specified filesystem location and returns the Path object.
QuadraticToQuadraticTo.x1 represents the x‑coordinate of the quadratic Bézier control point.
RasterizerScanline rasterizer for GlyphPath outlines with pure-Python PNG export.
RequestedLanguageHintRequestedLanguageHint.to_dict returns a dictionary representation of the hint object.
ResolvedInstanceResolvedInstance.label is the human‑readable name of the resolved instance.
SmartInstancerSmartInstancer.instantiate(coordinates, instance_name, naming_strategy, family_suffix, legacy_family_name, typographic_family_name, legacy_style_name, typographic_style_name, stat_policy) returns a TtfFont object representing a static instance of the variable font.
SubsetCoverageAggregate Unicode coverage diagnostics for a subsetting request.
SubsetResultSubsetting output bundled with the coverage report used to produce it.
TaskCompletionReceiptTaskCompletionReceipt.task_id identifies the task uniquely.
TaskTokenEstimateTaskTokenEstimate.task_id is the unique identifier of the task.
TextDeltaComparisonReportTextDeltaComparisonReport.to_dict() returns a dictionary containing all report fields.
TextDeltaReportTextDeltaReport aggregates glyph‑level delta information, exposing glyph_count, active_glyph_count, and a collection of glyph_reports for QA inspection.
TextLayoutResult of a TextRenderer.layout() call.
TextRendererLays out text using a font’s glyph metrics and optional kern pairs.
TtfSerializerTtfSerializer.serialize serializes the given font object to a byte array, optionally using the provided sfnt version.
TupleScalarDeltaTupleScalarDelta.to_dict() returns a dict with tuple_index, before_scalar and after_scalar values.
Type1SerializerType1Serializer.serialize_pfb converts a font object to PFB binary data.
UnsupportedFontFormatExceptionRaised by FontLoader when the file magic bytes are not recognized.
VariableAxisVariableAxis.normalize(value) returns the normalized (0‑1) position of a raw axis coordinate according to the axis’s defined range.
VariableAxisPresetVariableAxisPreset.to_presentation(axis) returns a dictionary of presentation metadata for the preset, suitable for UI rendering of preset controls.
VariableInstanceVariableInstance.css_variation_settings(axes) produces a tuple of CSS font-variation-settings strings for the given collection of axes.
WebFontAssetWebFontAsset.filename stores the original font file name as a string.
WebFontBuilderWebFontBuilder can generate complete web‑font families with CSS, HTML preview pages and manifest files ready for deployment.
WebFontBundleWebFontBundle.write_to writes the bundle to a directory and returns the list of written file paths.
WebFontFamilyPackageWebFontFamilyPackage.write_to(directory) creates a complete family package containing CSS, HTML, a manifest, and all bundled font assets for multiple style variants.

Enumerations

EnumerationDescription
FontTypeFontType.TTF represents the TrueType font format.

CFF Font Handling

ClassDescription
CffCharsetCffCharset.standard(num_glyphs) creates a standard CFF charset for the given number of glyphs, and name_for(gid) returns the glyph name for a glyph ID.
CffDictCffDict.from_bytes creates a CffDict instance from the given binary data.
CffEncodingCffEncoding.unicode_to_gid(codepoint) returns the GlyphId for a Unicode codepoint according to the current CFF encoding.
CffFontCffFont.get_kern_pairs() returns a list of KernPair objects representing the kerning adjustments defined in the font.
CffIndexCffIndex.from_reader(r) creates a CffIndex instance by parsing data from a binary reader r.
PrivateDictPrivateDict.from_dict(d) creates a PrivateDict instance from a dictionary containing private dict entries such as default_width_x and nominal_width_x.
PrivateDictOpPrivateDictOp.BLUE_VALUES represents the BlueValues entry defining alignment zones for horizontal stems.
TopDictTopDict.from_dict(d, string_index) creates a TopDict instance from a dictionary representation and a string‑index table, allowing programmatic reconstruction of font top‑level metadata.
TopDictOpTopDictOp.VERSION represents the font’s version number.
Type2InterpreterInterprets Type 2 charstrings into GlyphPath commands.

EOT Font Handling

ClassDescription
EotFontEmbedded OpenType (EOT) wrapper over an inner TrueType/OpenType font.
EotHeaderEotHeader.eot_size is the total size of the EOT file in bytes.

TrueType Font Handling

ClassDescription
AvarAxisMapAvarAxisMap.mapping stores a list of (float, float) tuples that define input‑output value mappings for a variable font axis.
AvarTableAvarTable.from_reader(r, length) constructs an AvarTable from a binary reader, and map_normalized(axis_index, value) returns the mapped float for a normalized axis coordinate.
AxisRecordAxisRecord.tag stores the four‑character axis tag identifier (e.g., ‘wght’).
CmapSubtableCmapSubtable.get_gid returns the glyph ID for a Unicode codepoint or None if unmapped.
CmapTableCmapTable.from_reader(r, table_length) parses a cmap table from a font stream, and best_subtable() selects the most suitable CmapSubtable for Unicode lookups.
DeltaSetIndexDeltaSetIndex.outer represents the outer index component of a delta set location.
DeltaSetIndexMapDeltaSetIndexMap.from_reader(r) constructs a DeltaSetIndexMap from a binary reader, and get(gid) retrieves the corresponding DeltaSetIndex.
FvarTableFvarTable.from_reader creates a new FvarTable by reading length bytes from a BinaryReader.
GlyfTableGlyfTable.from_reader reads a GlyfTable from a BinaryReader using the specified length and returns a GlyfTable instance.
GvarTableGvarTable.from_reader reads a GvarTable from a BinaryReader using the given length and axis tags.
HMetricClass with 2 properties.
HeadTableHeadTable.from_reader reads a BinaryReader and returns a populated HeadTable instance.
HheaTableHheaTable.from_reader reads a BinaryReader and constructs a HheaTable object.
HmtxTableHmtxTable.from_reader reads hmtx data from a BinaryReader and creates an HmtxTable instance.
HvarTableHvarTable.advance_width_delta(gid, normalized_coordinates) returns the width adjustment for a glyph ID at the specified normalized axis coordinates.
ItemVariationDataItemVariationData.from_reader creates an ItemVariationData instance by reading binary data from a BinaryReader.
ItemVariationStoreItemVariationStore.evaluate(delta_set_index, coordinates) computes the delta adjustment for a variable‑font axis based on supplied normalized coordinates.
KernTableKernTable.build_lookup() creates a dictionary mapping (left_gid, right_gid) tuples to kerning values for fast lookup.
LocaTableLocaTable.glyph_offset(gid) returns the byte offset of the glyph data for the given glyph ID within the font’s glyf table.
MaxpTableMaxpTable.to_bytes returns the binary encoding of the MaxpTable.
NameRecordNameRecord.platform_id identifies the platform for which the name record applies.
NameTableNameTable.language_key returns a language tag string for the given platform_id and language_id.
NamedInstanceNamedInstance.name_id is the integer identifier for the instance’s name record.
NamingPolicyPreviewDry-run result for generated static-instance name records.
Os2TableOs2Table.from_reader(r, table_length) parses an OS/2 table from a binary reader and returns an Os2Table instance.
PlatformNamingDiagnosticsPlatformNamingDiagnostics provides boolean flags and length checks (e.g., postscript_name_safe, postscript_name_length) to help ensure generated names meet platform constraints.
PostTablePostTable.version holds the version number of the post table.
StatNamingDiagnosticsStatNamingDiagnostics reports whether the source font contains STAT tables and recommends appropriate stat_policy settings for export.
TtcFaceRecordTtcFaceRecord.offset represents the byte offset of this face record within the TTC file.
TtfFontTtfFont.save(path) writes the current font instance to the supplied filesystem path in its native format.
TtfGlyphParserTtfGlyphParser.parse parses the glyph identified by the given GlyphId and returns a Glyph object.
TtfInstancerTtfInstancer.preview_naming_policy returns a naming preview for a variable font instance based on given coordinates and naming options.
TtfTableSetTtfTableSet.get_raw returns the raw bytes of the table identified by the given tag, or None if absent.
TupleVariationTupleVariation.peak_coords holds the axis coordinate values that define the variation peak.
VariationRegionVariationRegion.scalar returns a scalar value for the region based on given coordinate mapping and axis tag order.
VariationRegionAxisVariationRegionAxis.scalar(coordinate) returns the scalar float value for a given coordinate along the axis, using the axis’s start, peak, and end properties.

Type1 Font Handling

ClassDescription
AfmDataAfmData.font_name is the PostScript name of the font extracted from the AFM file.
AfmGlyphMetricAfmGlyphMetric properties expose glyph name, code point, advance width, and bounding box for a glyph defined in an AFM file.
PfbSegmentPfbSegment.seg_type represents the integer identifier of the segment type in a PFB file.
Type1FontType1Font.load_afm loads an AFM file from the given path into the Type1Font instance.
Type1FontDataType1FontData.full_name is the full human‑readable name of the font.
Type1InterpreterType1Interpreter.interpret interprets a Type 1 charstring and returns a GlyphPath with the bytes consumed.

WOFF / WOFF2 Handling

ClassDescription
Woff2FontWoff2Font.to_bytes(font_type) serializes the WOFF2 font into a bytes object for the specified font_type.
WoffFontWoffFont.font_type returns the FontType enumeration value of this WOFF font.

See Also