VariableAxis
Overview
VariableAxis is a class in Aspose.Font FOSS for Python.
VariableAxis.normalize(value) returns the normalized (0‑1) position of a raw axis coordinate according to the axis’s defined range.
This class provides 14 methods for working with VariableAxis objects in Python programs.
Available methods include: clamp, css_variation_setting, describe_value, format_value, get_preset, language_profiles, localization_coverage, localization_resolution, localized_labels, name, normalize, requested_language_hints, and 2 additional methods.
All public members are accessible to any Python application after installing the Aspose.Font FOSS for Python package.
Properties: available_languages, css_axis_tag, default_preset, default_ratio, default_value, description, and 17 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
available_languages | tuple[str, ...] | Read | Gets the available languages. |
label | str | Read | Gets the label. |
description | str | None | Read | Gets the description. |
unit_label | str | Read | Gets the unit label. |
presentation_kind | str | Read | Gets the presentation kind. |
display_group | str | Read | Gets the display group. |
display_order | int | Read | Gets the display order. |
is_registered_axis | bool | Read | Gets the is registered axis. |
recommended_step | float | Read | Gets the recommended step. |
span | float | Read | Gets the span. |
default_ratio | float | None | Read | Gets the default ratio. |
presets | list[VariableAxisPreset] | Read | Gets the presets. |
is_hidden | bool | Read | Gets the is hidden. |
default_preset | VariableAxisPreset | None | Read | Gets the default preset. |
range_summary | str | Read | Gets the range summary. |
css_axis_tag | str | Read | Gets the css axis tag. |
tag | str | Read/Write | Gets or sets the tag. |
min_value | float | Read/Write | Gets or sets the min value. |
default_value | float | Read/Write | Gets or sets the default value. |
max_value | float | Read/Write | Gets or sets the max value. |
flags | int | Read/Write | Gets or sets the flags. |
name_id | int | Read/Write | Gets or sets the name id. |
names_by_language | dict[str, str] | Read/Write | Gets or sets the names by language. |
Methods
| Signature | Description |
|---|---|
name(language: str | tuple[str, ...]) → str | None | Returns the axis name string for the given language or None |
localization_resolution(language: str | tuple[str, ...]) → LocalizationResolution | Returns a LocalizationResolution indicating language granularity |
localization_coverage(language: str | tuple[str, ...]) → LocalizationCoverage | Returns a LocalizationCoverage describing how fully the axis is localized |
localized_labels(preferred_languages: str | tuple[str, ...]) → tuple[tuple[str, str], ...] | Returns a tuple of (language, label) pairs for the requested languages |
requested_language_hints(language: str | tuple[str, ...]) → tuple[RequestedLanguageHint, ...] | Returns a tuple of RequestedLanguageHint objects for the given language |
language_profiles(language: str | tuple[str, ...]) → tuple[LanguageProfile, ...] | Calls language_profiles on this VariableAxis instance. |
clamp(value: float) → float | ` returns the supplied coordinate clamped to the axis’s defined range |
normalize(value: float) → float | Scales a raw axis coordinate to the 0‑1 normalized range defined by the axis’s start, peak and end points |
format_value(value: float) → str | Returns a string representation of the value using the axis unit |
describe_value(value: float) → str | Returns a human‑readable description of the value with unit label |
css_variation_setting(value: float) → str | Returns a CSS string for the axis variation setting |
ui_control(language: str | tuple[str, ...]) → dict[str, object] | Returns a dictionary describing a UI control for the axis in the given language |
get_preset(name: str) → VariableAxisPreset | None | Returns the VariableAxisPreset matching the name or None |
to_presentation(language: str | tuple[str, ...], suggested_values: tuple[float, ...] | list[float] | None) → dict[str, object] | Returns a dict describing the axis for UI, optionally with suggested values |