Features Overview
Features Overview
This guide covers the main capabilities of Aspose.Font for Python via .NET, showing how to load, inspect, convert, and optimize font files. Aspose.Font FOSS for Python is a pure-Python toolkit for programmatic font processing. It covers the full lifecycle from loading a font file to exporting a modified or subsetted version, with no OS-level font library dependencies.
Font Loading
FontLoader accepts file paths and raw bytes. It auto-detects TTF, OTF, CFF, WOFF,
WOFF2, EOT, and Type 1 formats. Use FontLoader.open() for paths and FontLoader.load()
for byte arrays.
from aspose_font.loader import FontLoader
font = FontLoader.open("Roboto-Regular.ttf")Font Metadata Access
Font base class exposes font_name, font_family, font_style, num_glyphs,
encoding, glyph_accessor, and metrics.
Glyph Access and Outline Paths
GlyphAccessor provides get_glyph_by_id(), get_glyph_by_unicode(), and
get_glyphs_for_text(). Each Glyph object has a path of typed commands:
MoveTo, LineTo, QuadraticTo, CurveTo, ClosePath.
Font Conversion
FontConverter.convert() converts between all supported formats.
CurveAdapter adapts Bézier path types between quadratic and cubic.
Font Subsetting
FontSubsetter supports subset_by_text(), subset_by_gids(), subset_for_web(),
subset_by_presets(), and coverage analysis via analyze_coverage() and analyze_web_coverage().
Web Font Optimization
FontCleaner.clean_for_web(font, drop_mac_names, drop_legacy_tables, drop_metadata_tables)
strips DSIG, FFTM, and meta tables, removes Mac platform name records when drop_mac_names
is set, drops legacy OS/2 tables when drop_legacy_tables is set, and strips metadata
tables when drop_metadata_tables is set. The method returns a Font object with the
cleaned data.
Variable Font Previews
AnimationPreviewBuilder generates animated APNG files for axis sweeps (build_axis_sweep())
and multi-step animation paths (build_path()). Results are AnimationAsset objects
that write to disk via write_to().
Compatibility Checking
CompatibilityChecker.compare_fonts() and compare_variable_instances() check glyph
outline compatibility between two font versions.
Format Support
| Format | Extension | Read | Write |
|---|---|---|---|
| TTF | .ttf | Yes | Yes |
| OTF | .otf | Yes | Yes |
| CFF | .cff | Yes | Yes |
| TYPE1 | .pfb / .pfa | Yes | Yes |
| WOFF | .woff | Yes | Yes |
| WOFF2 | .woff2 | Yes | Yes |
| EOT | .eot | Yes | Yes |