Aspose.Font FOSS for Python is a pure-Python toolkit for loading, inspecting, converting, subsetting, and previewing fonts across TrueType, OpenType, CFF, Type 1, WOFF, WOFF2, and EOT formats. The library runs on Python 3.10 or later and requires no external OS font libraries or native dependencies.
The library exposes a clean API for font loading via FontLoader, glyph access via GlyphAccessor, format conversion via FontConverter, web optimization via FontCleaner, text-aware subsetting via FontSubsetter, and variable font animation via AnimationPreviewBuilder. Font metadata such as name, family, style, glyph count, encoding, and metrics is accessible through the Font base class without parsing binary tables manually.
Aspose.Font FOSS is MIT licensed and installable from PyPI with a single pip install command. It is suitable for font design tooling, web font pipelines, glyph rendering engines, and any Python application that needs to read, transform, or produce font files.
Open a TrueType or OpenType font from a file path and read its basic metadata.
from aspose_font.loader import FontLoader
font = FontLoader.open("Roboto-Regular.ttf")
print(font.font_name) # e.g. "Roboto"
print(font.font_family) # e.g. "Roboto"
print(font.num_glyphs) # e.g. 1294
Resolve all glyphs for a Unicode code point and inspect their outline paths.
from aspose_font.loader import FontLoader
font = FontLoader.open("OpenSans-Regular.otf")
glyph_id = font.encoding.unicode_to_gid(0x41) # Unicode for A
glyph = font.glyph_accessor.get_glyph_by_id(glyph_id)
for cmd in glyph.path.commands:
print(type(cmd).__name__, cmd)
Create an animated APNG that sweeps a variable font axis from start to end value.
from aspose_font.loader import FontLoader
from aspose_font.animation import AnimationPreviewBuilder
font = FontLoader.open("Roboto-VariableFont_wdth,wght.ttf")
asset = AnimationPreviewBuilder.build_axis_sweep(
font,
axis_tag="wdth",
start_val=75.0,
end_val=100.0,
frames=3,
fps=10,
text="A",
size=10.0,
bounce=True,
)
asset.write_to("roboto-sweep-wdth.png")
Strip legacy tables and Mac name records to reduce binary size before web serving.
from aspose_font.loader import FontLoader
from aspose_font.cleaner import FontCleaner
font = FontLoader.open("Roboto-Regular.ttf")
cleaned = FontCleaner.clean_for_web(font)
# DSIG, FFTM, meta tables removed; Mac platform name records stripped
It is a free, MIT-licensed pure-Python library for loading, inspecting, converting, and subsetting fonts in TTF, OTF, CFF, Type 1, WOFF, WOFF2, and EOT formats. No native dependencies are required.
Run pip install "aspose-font>=1.0.0". No system-level dependencies are needed. The library works on Windows, macOS, and Linux with Python 3.10 or later.
FontLoader.open() reads TTF, OTF, CFF, Type 1, WOFF, WOFF2, and EOT. FontConverter.convert() writes TTF, CFF, WOFF, and WOFF2. EOT is read-only.
No. Font.to_bytes() is not implemented in the base class. Use FontConverter.convert() to produce a new Font in the desired format.
Yes. FontSubsetter.subset_by_text(font, text) returns a new Font containing only the glyphs required for the given text. FontSubsetter.subset(font, codepoints) and subset_by_gids(font, gids) give finer control.