FontSubsetter
Overview
FontSubsetter is a class in Aspose.Font FOSS for Python.
FontSubsetter.available_presets() returns a tuple of preset names that can be used for web‑oriented subsetting.
This class provides 11 methods for working with FontSubsetter objects in Python programs.
Available methods include: analyze_coverage, analyze_web_coverage, available_presets, resolve_codepoints, subset, subset_by_gids, subset_by_presets, subset_by_text, subset_for_web, subset_for_web_with_coverage, subset_with_coverage.
All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package.
Methods
| Signature | Description |
|---|---|
available_presets() → tuple[str, ...] | Returns a tuple of preset names that can be used for web‑oriented subsetting |
subset(font: Font, codepoints: set[int]) → Font | Creates a new Font containing only the glyphs for the supplied Unicode codepoints |
subset_by_text(font: Font, text: str) → Font | Automatically resolves the required codepoints from a string and returns a reduced Font |
subset_by_gids(font: Font, gids: set[int]) → Font | Creates a new Font containing only the glyphs identified by the given glyph IDs |
subset_by_presets(font: Font, presets: str | Iterable[str]) → Font | Creates a new Font containing glyphs defined by one or more preset groups |
subset_for_web(font: Font, presets: str | Iterable[str], text: str, codepoints: Iterable[int], ranges: Iterable[tuple[int, int] | range]) → Font | Creates a new Font using presets, text, explicit codepoints, and ranges for web workflows |
subset_with_coverage(font: Font, codepoints: set[int]) → SubsetResult | Subset by codepoints and return both the new font and coverage diagnostics. |
subset_for_web_with_coverage(font: Font, presets: str | Iterable[str], text: str, codepoints: Iterable[int], ranges: Iterable[tuple[int, int] | range]) → SubsetResult | Subset from web selection inputs and include grouped coverage diagnostics. |
analyze_coverage(font: Font, codepoints: Iterable[int], groups: Iterable[CoverageGroup]) → SubsetCoverage | Report which requested Unicode codepoints the font can encode. |
analyze_web_coverage(font: Font, presets: str | Iterable[str], text: str, codepoints: Iterable[int], ranges: Iterable[tuple[int, int] | range]) → SubsetCoverage | Report coverage for combined preset, text, codepoint, and range inputs. |
resolve_codepoints(presets: str | Iterable[str], text: str, codepoints: Iterable[int], ranges: Iterable[tuple[int, int] | range]) → set[int] | Accepts any combination of preset names, raw text, explicit codepoint lists, or Unicode ranges and returns a deduplicated set of integer codepoints |