SmartInstancer
Overview
SmartInstancer is a class in Aspose.Font FOSS for Python.
SmartInstancer.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.
This class provides 32 methods for working with SmartInstancer objects in Python programs.
Available methods include: __init__, build_axis_grid_previews, build_axis_grid_sheet, build_axis_grid_web_bundles, build_axis_grid_web_family_package, build_comparison_sheet, build_delta_comparison_sheet, build_delta_sheet, build_delta_text_comparison_sheet, build_delta_text_sheet, build_family_review_board, build_family_review_export_package, and 20 additional methods.
All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package.
Properties: axes, default_coordinates, font, named_instances.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
font | "TtfFont" | Read | Gets the font. |
axes | `` | Read | Gets the axes. |
named_instances | `` | Read | Gets the named instances. |
default_coordinates | dict[str, float] | Read | Gets the default coordinates. |
Methods
| Signature | Description |
|---|---|
__init__(font: "TtfFont") | Calls init on this SmartInstancer instance. |
suggest_axis_values(axis_tag: str, include_default: bool, include_bounds: bool) → list[float] | Returns suggested float values for an axis, optionally including defaults and bounds |
resolve_axis_grid(axis_tag: str, values: list[float | str] | tuple[float | str, ...], secondary_axis_tag: str | None, secondary_values: list[float | str] | tuple[float | str, ...], coordinates: dict[str, float | str] | None, instance_name: str | None, use_axis_presets: bool, use_secondary_axis_presets: bool, include_default: bool, include_bounds: bool) → list[ResolvedInstance] | Resolves a grid of instances for one or two axes and returns ResolvedInstance objects |
resolve(coordinates: dict[str, float | str] | None, instance_name: str | None) → ResolvedInstance | Resolves a single set of coordinates or a named instance to a ResolvedInstance |
instantiate(coordinates: dict[str, float | str] | None, instance_name: str | None, naming_strategy: str, family_suffix: str | None, legacy_family_name: str | None, typographic_family_name: str | None, legacy_style_name: str | None, typographic_style_name: str | None, stat_policy: str) → "TtfFont" | Creates a static TtfFont from coordinates or a named instance using naming and STAT options |
preview_naming_policy(coordinates: dict[str, float | str] | None, instance_name: str | None, naming_strategy: str, family_suffix: str | None, legacy_family_name: str | None, typographic_family_name: str | None, legacy_style_name: str | None, typographic_style_name: str | None, stat_policy: str) | Shows how a naming strategy will name an instance without creating a font |
instantiate_named(name: str, coordinates: dict[str, float | str] | None, naming_strategy: str, family_suffix: str | None, legacy_family_name: str | None, typographic_family_name: str | None, legacy_style_name: str | None, typographic_style_name: str | None, stat_policy: str) → "TtfFont" | Instantiates a font by a predefined name with full naming and STAT control |
resolve_named_many(names: list[str] | tuple[str, ...] | None, include_default: bool) → list[ResolvedInstance] | Resolves multiple named instances (or defaults) to a list of ResolvedInstance objects |
instantiate_many(names: list[str] | tuple[str, ...] | None, include_default: bool, naming_strategy: str, family_suffix: str | None, legacy_family_name: str | None, typographic_family_name: str | None, legacy_style_name: str | None, typographic_style_name: str | None, stat_policy: str) → list[tuple[ResolvedInstance, "TtfFont"]] | Creates fonts for many named instances and returns pairs of ResolvedInstance and TtfFont |
build_web_bundle(coordinates: dict[str, float] | None, instance_name: str | None) → WebFontBundle | Packages a single instance into a WebFontBundle for web deployment |
build_preview(coordinates: dict[str, float | str] | None, instance_name: str | None, output_format: str) → PreviewImage | returns aPreviewImage` that can be saved as PNG, SVG, or APNG depending on the chosen format |
build_web_bundles(names: list[str] | tuple[str, ...] | None, include_default: bool) → list[tuple[ResolvedInstance, WebFontBundle]] | Creates WebFontBundles for multiple instances or defaults |
build_axis_grid_web_bundles(axis_tag: str, values: list[float | str] | tuple[float | str, ...], secondary_axis_tag: str | None, secondary_values: list[float | str] | tuple[float | str, ...], coordinates: dict[str, float | str] | None, instance_name: str | None, use_axis_presets: bool, use_secondary_axis_presets: bool, include_default: bool, include_bounds: bool) → list[tuple[ResolvedInstance, WebFontBundle]] | Builds web bundles for a two‑axis grid of instances |
build_axis_grid_web_family_package(axis_tag: str, values: list[float | str] | tuple[float | str, ...], secondary_axis_tag: str | None, secondary_values: list[float | str] | tuple[float | str, ...], coordinates: dict[str, float | str] | None, instance_name: str | None, family_name: str | None) → WebFontFamilyPackage | Creates a WebFontFamilyPackage from an axis grid with an optional family name |
build_previews(names: list[str] | tuple[str, ...] | None, include_default: bool, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool, output_format: str) → list[tuple[ResolvedInstance, PreviewImage]] | Generates preview images for many instances with common visual settings |
build_web_family_package(names: list[str] | tuple[str, ...] | None, include_default: bool, family_name: str | None) → WebFontFamilyPackage | ` bundles a set of static and variable font files together with CSS and HTML preview assets for web deployment |
build_axis_grid_previews(axis_tag: str, values: list[float] | tuple[float, ...], secondary_axis_tag: str | None, secondary_values: list[float] | tuple[float, ...], coordinates: dict[str, float] | None, instance_name: str | None, use_axis_presets: bool, use_secondary_axis_presets: bool, include_default: bool, include_bounds: bool, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool, output_format: str) → list[tuple[ResolvedInstance, PreviewImage]] | Renders preview images for each point in a two‑axis grid |
build_axis_grid_sheet(axis_tag: str, values: list[float] | tuple[float, ...], secondary_axis_tag: str | None, secondary_values: list[float] | tuple[float, ...], coordinates: dict[str, float] | None, instance_name: str | None, use_axis_presets: bool, use_secondary_axis_presets: bool, include_default: bool, include_bounds: bool, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool, gap: int, file_stem: str) → PreviewImage | generates a specimen sheet image that sweeps a primary and optional secondary axis across specified values, returning aPreviewImage` |
build_comparison_sheet(before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, text: str, size: float, color: tuple[int, int, int], background: tuple[int, int, int], padding: int, antialias: bool, gap: int, file_stem: str) → PreviewImage | ` creates a side‑by‑side PNG comparison of two variable‑font instances, useful for visual QA |
build_waterfall_sheet(names: list[str] | tuple[str, ...] | None, include_default: bool, text: str, file_stem: str) → PreviewImage | Creates a waterfall specimen sheet for multiple instances with a single text line |
build_matrix_sheet(names: list[str] | tuple[str, ...] | None, include_default: bool, text: str, file_stem: str) → PreviewImage | Generates a matrix‑style specimen sheet for a set of instances |
build_family_review_board(names: list[str] | tuple[str, ...] | None, include_default: bool, text: str, family_name: str | None, file_stem: str) → PreviewImage | Creates a review board image showing instances of a family with optional name |
build_family_review_export_package(names: list[str] | tuple[str, ...] | None, include_default: bool, text: str, family_name: str | None, file_stem: str) → FamilyReviewExportPackage | Assembles review assets (images, metadata) for a family export |
check_compatibility(before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, codepoints: list[int] | tuple[int, ...] | None, text: str) → CompatibilityReport | Compares two instances for glyph compatibility over given codepoints or text |
inspect_deltas(glyph_id: int | None, codepoint: int | None, coordinates: dict[str, float] | None, instance_name: str | None, top_points: int) → GlyphDeltaReport | Reports delta information for a single glyph or codepoint between coordinates |
build_delta_sheet(glyph_id: int | None, codepoint: int | None, coordinates: dict[str, float] | None, instance_name: str | None, top_points: int, panel_size: int, file_stem: str) → PreviewImage | Creates a preview image visualizing glyph deltas for a given instance |
inspect_delta_text(text: str, coordinates: dict[str, float] | None, instance_name: str | None, top_points: int) → TextDeltaReport | Generates a delta report for all glyphs in a text string under given coordinates |
compare_delta_glyph(glyph_id: int | None, codepoint: int | None, before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, top_points: int) → GlyphDeltaComparisonReport | Compares delta data for a glyph before and after a coordinate change |
compare_delta_text(text: str, before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, top_points: int) → TextDeltaComparisonReport | Compares delta reports for a whole text string between two instances |
build_delta_text_sheet(text: str, coordinates: dict[str, float] | None, instance_name: str | None, top_points: int, panel_size: int, columns: int, file_stem: str) → PreviewImage | Renders a preview image showing delta panels for each glyph in a text |
build_delta_text_comparison_sheet(text: str, before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, top_points: int, panel_size: int, columns: int, file_stem: str) → PreviewImage | Creates a side‑by‑side delta comparison sheet for a text string |
build_delta_comparison_sheet(glyph_id: int | None, codepoint: int | None, before_coordinates: dict[str, float] | None, after_coordinates: dict[str, float] | None, before_instance_name: str | None, after_instance_name: str | None, top_points: int, panel_size: int, file_stem: str) → PreviewImage | Calls build_delta_comparison_sheet on this SmartInstancer instance. |